<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><span>Perl Folks,</span></div><div>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?</div><div> </div><div>perl -e '<br>use strict;<br>use warnings;<br>use Path::Class qw{file};</div><div>my @files=qw{X Y Z}; #really large files</div><div>my $out=file("out.txt")->openw;<br>foreach my $file (@files) {<br>  my $fh=file($file)->openr;<br>  print $out <$fh>; #does this read to memory then print or does it do something better?<br>}<br>'</div><div> </div><div>Or do I really need to read line by line something like this...</div><div> </div><div>perl -e '<br>use strict;<br>use warnings;<br>use Path::Class qw{file};</div><div>my @files=qw{X Y Z}; #really large files</div><div>my
 $out=file("out.txt")->openw;<br>foreach my $file (@files) {<br>  my $fh=file($file)->openr;<br>  my $line;<br>  print $out $line while ($line=<$fh>);<br>}<br>'</div><div> </div><div>Thanks,</div><div>Mike</div></div></body></html>