You are not checking for existence of a file path, but the result of regex match against $_.
I think you would be better off (for some definition of "better") with Path::* solution suggested earlier instead of rolling a solution on your own. Also, please do the RTFM.
In reply to Re^3: searching files
by Anonymous Monk
in thread searching files
by michael99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |