my @AoA; my %HoAoA; my %HoAoH; while( my $line = ){ chomp $line; my @fields = split( /\s+\s+/, $line ); # Add an array ref (containing the data in @fields) onto the @AoA push( @AoA, [ @fields ] ); # Add an array ref (containing the last 2 elements of @fields) # onto the %HoAoA. The key in the %HoAoA is $fields[0], and # the value is an array ref. '@fields[ 1, 2 ]' is an array # slice and is shorthand for ( $fields[1], $fields[2] ) push( @{ $HoAoA{$fields[0]} }, [ @fields[ 1, 2 ] ] ); # Add a hash ref onto the %HoAoH. The key in the %HoAoH is # $fields[0], and the value is an array ref. The array # contains one or more hash refs. Each hash ref # contains the 'email' and 'result' keys. push( @{ $HoAoH{$fields[0]} }, { email => $fields[1], result => $fields[2] } ); }