The following code will do what you want:
#!/usr/bin/perl
use Data::Dumper;
my %HoA = ();
my %hash_track = ();
while(<DATA>) {
chomp($_);
my (@stuff) = split(" ", $_);
&fill(@stuff);
}
print Dumper(\%HoA);
sub fill() {
my @a = @_;
my @ar = @a[0,1,2,4,5,6,7];
my $h = $a[3];
$HoA{$h}[$hash_track{$h}] = [ @ar ];
$hash_track{$h}++;
}
__DATA__
334 Capped 28 5034366 16777215 NULL NULL NULL
373 Capped 28 5034366 16777215 NULL NULL NULL
output:
$VAR1 = {
'5034366' => [
[
'334',
'Capped',
'28',
'16777215',
'NULL',
'NULL',
'NULL'
],
[
'373',
'Capped',
'28',
'16777215',
'NULL',
'NULL',
'NULL'
]
]
};
%hash_track is used to increment the first level %HoA array.
hope this helps,
davidj |