Re: a question write to file! On 7/5/07, herostar1981  wrote: > for (my $i=0;$i<=$#data;$i++) >   {      $kml.="0station". > $sta[$i]."";} That _might_ be correct. But why does the loop count through the last element of the @data array, when you're processing the @sta array? And did you ever initialize $kml? Most uses of the computed for loop, like that one, are simpler as a foreach loop in Perl:   foreach my $i (0..$#data) { ... } Or even this:   foreach my $element (@data) { ... } > At this point, if I use following script, I can work as I wish: > print "Content-type: text/html\\n\\n"; > print $kml; > > if I use "print FID $kml;", the trouble is coming... What trouble? Are you saying that $kml printed to a file is different than $kml rendered in a web browser, or what? Good luck with it! --Tom Phoenix Stonehenge Perl Training --  To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional commands, e-mail: beginners-help@perl.org http://learn.perl.org/