Just wondering why you would set $/ to the null string?
First I would suggest doing so in a local-context (although it doesn't hurt in such a small script as yours) so it gets automatically "reset" when you leave the enclosing scope.
By setting $/ to the null string, the input record separator becomes one or more blank lines (multiple blank lines gets collapsed into one).
If you just want to slurp the whole of the file at once (without collapsing multiple blank lines into one as a side effect), do a
undef $/;and then you can drop the whole
loop and just do awhile (<INFILE>) {@lines = $_;} foreach (@lines) {print LOGFILE $_;}
$line=<INFILE>; print LOGFILE, $line;
Staying closer to your script
while (my $line=<INFILE>){print LOGFILE,$line;}is somewhat more elegant, IMHO.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Re: Writing one File from Various Files in a Directory
by CountZero
in thread Writing one File from Various Files in a Directory
by dfmsrsa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |