in reply to Re: Writing one File from Various Files in a Directory
in thread Writing one File from Various Files in a Directory

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
while (<INFILE>) {@lines = $_;} foreach (@lines) {print LOGFILE $_;}
loop and just do a
$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

Replies are listed 'Best First'.
Re: Re: Re: Writing one File from Various Files in a Directory
by WhiteBird (Hermit) on Jun 21, 2003 at 13:29 UTC
    Thanks for the input on this point, Count. I originally used this script to get name/address information off of cover sheets used for mailing reports. I needed to slurp the information on each page into one line. However, I think the question in this case is going to require your approach. ++For the explanation.