in reply to multicolumn files
my @array1 = ( "1 2 3 4 5", "2 3 4 5 6", "3 4 5 6 7" ); my @array2 = ( "a b c d", "b c d e", "f g h i" ); my @join; for my $elem ( @array1 ){ push @join, "$elem " . shift @array2; } print "$_\n" for @join;
Output:
1 2 3 4 5 a b c d 2 3 4 5 6 b c d e 3 4 5 6 7 f g h i
Also, you should use the three-argument form of open(), and inform if something goes wrong:
open my $fh, '<', 'path to file' or die "Can't open the damned file!: +$!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multicolumn files
by Anto_ch (Initiate) on Jun 06, 2012 at 17:17 UTC | |
by stevieb (Canon) on Jun 06, 2012 at 17:35 UTC |