# An array of hash references can be pretty nice, too: my @c = ( { a=>6, b=>3 }, { a=>7, b=>2 }, { a=>8, b=>1 }, ); # Then printing the related data is easy, and you needn't track the array index for my $item (@c) { print $item->{a},"\n" if $item->{b}>1; }