in reply to Re: if file does not exist
in thread if file does not exist

I think your solution is actually better because -e will return true for a directory too. So-

next if not -f $fname; # or the somewhat too dense warn "$fname is not a file" and next unless -f $fname;