Tested & working
so you can adapt that line to last if grep /$file/,readdir(DIR) ; to make your loop exit early#!/Perl/bin/perl use strict; use warnings; my $dir = 'c:/'; my $file = 'autoexec.bat'; opendir(DIR,$dir); print "found" if grep /$file/,readdir(DIR) ; closedir(DIR);
In reply to Re: Search Directory
by Grygonos
in thread Search Directory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |