Juerd and bronto are completely correct.
If you mean for the user input 1 (found in @thearray) to indicate @array_1 and the first element of @column, then you must subtract 1, since Perl arrays are zero-based.
Also, if @array_1 and its siblings exist solely to populate @bigarray, then you could replace them with [], the empty anonymous array constructor, as I have done (and then commented out) below.
Here is a working code sample:
#!/usr/bin/perl -W
use strict;
my (@array_1,@array_2,@array_3,@array_4,@array_5,@array_6);
my @big = \(@array_1,@array_2,@array_3,@array_4,@array_5,@array_6);
#my @big = map [], 1..6;
my @thearray = (1, 4, 6);
#my $line = <INFILE>;
my $line = 'able baker charlie roger fox dog';
my @column = split " ", $line;
push @{$big[$_]}, [$line, $column[$_]] foreach map {$_-1} @thearray;
use Data::Dumper;
#print Data::Dumper->Dump([\@big], ['*big']);
print Data::Dumper->Dump(
[ \(@array_1,@array_2,@array_3,@array_4,@array_5,@array_6)],
[qw(*array_1 *array_2 *array_3 *array_4 *array_5 *array_6)],
);
This is the (reformatted) output:@array_1 = ( [ 'able baker charlie roger fox dog', 'able' ] );
@array_2 = ( );
@array_3 = ( );
@array_4 = ( [ 'able baker charlie roger fox dog', 'roger' ] );
@array_5 = ( );
@array_6 = ( [ 'able baker charlie roger fox dog', 'dog' ] );
|