use strict; use warnings; use Data::Dumper; my %hash = ( foo => 'bar', football => 'Monday', one_thing => 'another', ); my @match = grep /^foo/, keys %hash; print Dumper \@match;