http://qs321.pair.com?node_id=161996


in reply to Find a file in a list of directories

more compact version of your code. And you should use '-e' test instead of '-t'
#!/usr/bin/perl sub FileFinder { my ($target, @dir) = @_; return (grep {-e $_} map {"$_/$target"} @dir)[0]; } open(F, FileFinder('FileFinder.pl', qw(some/ dirs/ ./)) || die "File n +ot found") or die $!;