in reply to RE (tilly) 1: Merging files
in thread Merging files
The advantage here is that we're rewriting @handles in one fell swoop in the fairly strongly optimized grep operation, not constantly shifting and pushing on an array that will just keep wandering through higher and higher memory. {grin}while (@handles) { @handles = grep { if (defined(my $line = readline($_))) { print $line; 1; } else { 0 } } @handles; }
-- Randal L. Schwartz, Perl hacker
|
|---|