Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: I need a "non-trivial" bug for my script!

by f00li5h (Chaplain)
on Feb 27, 2009 at 00:36 UTC ( #746719=note: print w/ replies, xml ) Need Help??


in reply to Re^3: I need a "non-trivial" bug for my script!
in thread I need a "non-trivial" bug for my script!

Do the match in list context, and don't use $\d+ at all

if (@kitties = $string =~ /pattern (with) captures/) { paw_at @kitties; }
Obviously you can use my($cats, $kittens) in place of @kitties there.

The other option is check that the match succeeded first

if ($string =~ /pattern (with) captures/) { paw_at $1; }
but $1 is ugly... unpacking into either an array or bundle of scalars will get you less maintenence-programmer hate.

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;


Comment on Re^4: I need a "non-trivial" bug for my script!
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-09-19 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (151 votes), past polls