in reply to Printing arrays to a file.
{ local $, = $/; open my $file,'>', $filename or die 'Couldn't open file: ", $!; print $file @my_array or die $!; close $file or die $!; }
That does it all in a single print statement without concatenation. On item at a time is printed and terminated with the portable newline, default $/. The error checking is a bonus, and the lexical filehandle will close itself it the block is exited abnormally. Run benchmarks if you like, it ought to be ok, but on a filesystem, performance first means getting it right. You want to know if the print fails.
After Compline,
Zaxo
|
|---|