http://www.perlmonks.org?node_id=876785

perl_mystery has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have the following two simple questions.I wrote the following ,need your input if there is a better way.

1.I want to grep for a variable $filename for all the keys in a hash "path_versions",

grep (/$filename/i, $key) foreach my $key (keys %path_versions)

2.I have the below line in a variable "$depopath" where parts of it are seperated by spaces,I want to get only the part after the last space.In this case just "Z:\repo\bin\tools\scripts\shared\users\script.pl"

+//depot/asic/tools/scripts/shared/users/script.pl //cspec/tools/scripts/shared/users/script.pl Z:\repo\bin\tools\scripts\shared\users\script.pl

my $match = $depopath =~ /\s(.:.+?)/