Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: How to grep exact string

by tobyink (Abbot)
on Nov 15, 2012 at 08:49 UTC ( #1003962=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to grep exact string
in thread How to grep exact string

My suggested grep has been correct Perl syntax since Perl 5.0. (Perhaps before?)

Note there are no parentheses after the grep... not this:

grep({ ... } @list)

And note that there's no comma after the block... not this:

grep { ... }, @list

It just needs to be like this:

grep { ... } @list

If you really want parentheses, they can go on the outside:

(grep { ... } @list)
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^3: How to grep exact string
Select or Download Code
Re^4: How to grep exact string
by frozenwithjoy (Curate) on Nov 15, 2012 at 08:55 UTC
    I think what is breaking it for me is the $_ eq $unique. When I include that, real matches don't register as matches.

    EDIT: nevermind... typo.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-09-17 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls