use Hash::FindKeys qw( FindHashKeys ); # FindHashKeys finds keys of a hash where the key and # corresponding value meet certain criteria. Note that # ref($_[0]) must be "HASH" or it dies! [...] sub someMethod { my( $self )= shift @_; my @opts= FindHashKeys( $self, sub { /^-/ }, sub { $_ ne "" } ); # Oops, that dies! }