Move the file open and close outside the print loop. Note too that you should always check open results, use lexical file handles and use the three parameter version of open:
open my $out, '>', $fileName or die "Can't open '$fileName': $!\n"
In reply to Re: output file gives only last line
by GrandFather
in thread output file gives only last line
by henzcoop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |