in reply to
How to grep for a filename for each of the keys of a hash
1: $filename is presumably a string, not a pattern, which you want to match; so you have to escape metacharacters first if you're going to use it in a regular expression: /\Q$filename\E/, for example, if you don't want to modify that variable with the quotemeta function or don't need the quoted version for anything else ($foo = quotemeta $foo; or my $foo_quoted = quotemeta $foo;</code>).
- my ($foo) = $depopath =~ /\s(\S+)$/;
- or my ($foo) = reverse split ' ', $depopath;