Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: how to add more intelligence to grep functionality

by bobf (Monsignor)
on Jan 12, 2006 at 03:37 UTC ( [id://522610]=note: print w/replies, xml ) Need Help??


in reply to Re: how to add more intelligence to grep functionality
in thread how to add more intelligence to grep functionality

GrandFather gave you an example of how to make your code work, but I think a reference is in order (no, not that kind).

Instead of my $value = 'reve*ker';, as in your original code, GrandFather changed it to my $value = qr'reve.*ker';. See that little qr in there? That's the quote regex operator. It takes a string, compiles it into a regex, and returns it for later use. To quote perlop,

This operator quotes (and possibly compiles) its STRING as a regular expression. STRING is interpolated the same way as PATTERN in m/PATTERN/. If "'" is used as the delimiter, no interpolation is done. Returns a Perl value which may be used instead of the corresponding /STRING/imosx expression.

perlop. Lots of good stuff in there.

HTH

BTW, I'd like to second GrandFather's comment about long lines. Horizontal scrolling is awkward.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-16 09:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found