Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Passing regular expressions as arguments to subroutines

by johnnywang (Priest)
on Nov 02, 2005 at 23:03 UTC ( [id://505169]=note: print w/replies, xml ) Need Help??


in reply to Passing regular expressions as arguments to subroutines

Something like:
my $a = qr/turtle|fish/i; foo($a); sub foo{ my $reg = shift; if(ref($reg) eq 'Regexp'){ my $string = 'fisH'; print "hello" if ($string =~ $reg); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://505169]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-19 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found