Perl Folks,
Can anyone tell me if the diamond operator is optimized in a print statement or
does it really read the file into memory then print it?
perl -e '
use strict;
use warnings;
use Path::Class qw{file};
my @files=qw{X Y Z}; #really large files
my $out=file("out.txt")->openw;
foreach my $file (@files) {
my $fh=file($file)->openr;
print $out <$fh>; #does this read to memory then print or does it do
something better?
}
'
Or do I really need to read line by line something like this...
perl -e '
use strict;
use warnings;
use Path::Class qw{file};
my @files=qw{X Y Z}; #really large files
my $out=file("out.txt")->openw;
foreach my $file (@files) {
my $fh=file($file)->openr;
my $line;
print $out $line while ($line=<$fh>);
}
'
Thanks,
Mike_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/