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

Re: Regular expressions and sort

by japhy (Canon)
on Nov 04, 2005 at 14:48 UTC ( [id://505718]=note: print w/replies, xml ) Need Help??


in reply to Regular expressions and sort

No one seems to have mentioned that my $mask=/_(\d\d)_/; is Not the Code You Are Looking For. To put a regex in $mask, use qr// like so: my $mask = qr/_(\d\d)_/;

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: Regular expressions and sort
by ioannis (Abbot) on Nov 04, 2005 at 15:16 UTC
    I was also eyeballing the statement $mask=/_(\d\d)_/ . After some investigation with use re 'debugcolor', it turns out that the /_(\d\d)_/ gets compiled but nothing is stored in $mask. In effect, the statement

    $_[0] =~ /$mask/ is equal to $_[0] =~ //

      No, not "nothing". The result of $_ =~ /_(\d\d)_/, a boolean value, gets stored.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-18 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found