Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: An error message to understand

by Perl Mouse (Chaplain)
on Jan 06, 2006 at 12:14 UTC ( #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
Node Status?
node history
Node Type: note [id://521460]
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 2020-10-30 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (284 votes). Check out past polls.

    Notices?