Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: An error message to understand

by Perl Mouse (Chaplain)
on Jan 06, 2006 at 12:14 UTC ( [id://521460]=note: print w/replies, xml ) Need Help??


in reply to Re: An error message to understand
in thread An error message to understand

And since the pattern can never match the empty string, or 0, you could skip the define and write:
foreach (@CHOICE) { if ($_ && /.../) { ... } }
Or:
foreach (@CHOICE) { $_ or next; if (/.../) { ... } }
if all you have inside the foreach is the if statement.
Perl --((8:>*

Replies are listed 'Best First'.
Re^3: An error message to understand
by tirwhan (Abbot) on Jan 06, 2006 at 12:29 UTC

    I don't particularly want to argue about it but I would not approve of such a change. True, as the pattern match is now it does not make a difference, but if the pattern is ever changed it's easy to miss changing the test as well, which can introduce a subtle bug. Just checking for truth makes the code more brittle. IMO, YMMV, etc.


    There are ten types of people: those that understand binary and those that don't.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-18 23:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found