in reply to Re^4: Concatenating arrays fetched from different text files
in thread Concatenating arrays fetched from different text files
Assuming the files are passed as arguments to the script, you could have something as simple as this (untested):
Or did I misunderstand what you are after?my @array; # I would use a better name if I knew the array's contents for my $file (@ARGV) { open my $FH, "<", $file or die "cannot open $file $!" while (<$FH>) { chomp and push @array, $_ and last if $. == 4; } } print "@array\n";
|
|---|