%report = (); while (my $line = <$log_file>) { my @fields = (split / /, $line); $report{$_}++ foreach @fields[2,4,5,9,7,1]; } #### my @report; while (my $line = <$log_file>) { my @fields = (split / /, $line); foreach (@fields[2,4,5,9,7,1]) { my %hash; foreach (@fields[2,4,5,9,7,1]) { $hash{$_}++; } push @report, \%hash; } } #### 483 OS dx-32 1 charles list4 aardvark.com ty-off lx-on C 01 483 DS dx-14 1 james list3 23.456.12.7 ty-on lx-on B 01 769 XO dx-32 5 sully nolist widgets.com ty-on lx-on V 07 #### @report = ( { #### 2 or fields2, something like that dx-32 => 2, dx-14 => 1, }, { #### fields3, and so on