Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
P is for Practical
 
PerlMonks  

Re: Turning an argument into a regexp

by le (Friar)
on Aug 30, 2000 at 18:04 UTC ( [id://30361]=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 Turning an argument into a regexp

I don't think the File::Find module has problems with a variable being a regexp. But you should let Perl know that you actually mean a regexp. In your example, $regex is treated as a scalar, not as a regex. Try something like this:
my $regex = "\\.$searchfor"; $file =~ m/$regex/;
Putting the regex delimiters into the variable may work with an eval, but this is just a wild guess.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://30361]
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.