in reply to Merging 3 files
#!perl use strict; use warnings; my @handles; my $i = 0; for (@ARGV) { open $handles[$i++], '<', $_ or die "Failed to open $_: $!\n"; } my $line; $i = 0; while (1) { $line = <$handles[$i]>; defined($line) or last; print $line; } continue { ++$i; $i %= @handles; } close $_ for @handles;
|
|---|