Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Search Directory

by Grygonos (Chaplain)
on Feb 01, 2005 at 13:51 UTC ( [id://427010]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Search Directory

Tested & working

#!/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);
so you can adapt that line to last if grep /$file/,readdir(DIR) ; to make your loop exit early

Replies are listed 'Best First'.
Re^2: Search Directory
by Anonymous Monk on Feb 01, 2005 at 14:54 UTC
    Hi,
    Getting this back:

    Software error: Can't "last" outside a loop block

    Anyone knows why?

      yes, its a very desriptive error. It means you tried to cut and paste the last statement i provided into your program and didn't put that statement inside a loop construct.. so perl says "Last?!? ... last what?"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://427010]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.