When I read the contents of routers, it only contains one element of @file2use strict; die "Usage: <file1> <file2>\n" unless @ARGV == 2; my $file_1 = $ARGV[0]; my $file_2 = $ARGV[1]; open (FILE2, $file_2) or die "Couldn't open file: $!"; while (<FILE2>) { if ($_ =~ s/^confederation-as-router\:\W+\d\W+\d+\W//) { push(my @file2, $_); #I can print the entire array here. open (FILE3, '>routers') or die "Couldn't open file: $!"; print FILE3 @file2; close FILE3;
In reply to Writing the contents of an array to a file by Limo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |