in reply to slicing array based on values but not index

If you want to really pursue the answer of ssandv, you can try something below.
As you can see, it is not as nice and efficient as the one given by Bloodnok.
#!/usr/bin/perl use strict; use Data::Dumper; my %record; my %third_col; my @arr = ( [12, "abc", 30], [24, "abc", 30], [26, "abc", 30], [14, "abc", 40], [46, "abc", 40], [2, "abc", 50] ); $third_col{ $_->[2] }++ for (@arr); for my $i (@arr) { push ( @{ $record{$i->[2]} }, $i ) if ( grep /$i->[2]/, keys %third_col ); } print Dumper \%record;