Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: (crazyinsomniac) Re: Coding superstitions

by blakem (Monsignor)
on Jan 09, 2002 at 00:24 UTC ( #137242=note: print w/ replies, xml ) Need Help??


in reply to Re: (crazyinsomniac) Re: Coding superstitions
in thread Coding superstitions

Assuming you don't mind returning 1/undef instead of 1/0 I'd prefer this:

sub fred { $_[0] eq 'ooyah' }
Or, if you want to keep your '0', how about:
sub fred { $_[0] eq 'ooyah' or 0 }

-Blake


Comment on Re: Re: (crazyinsomniac) Re: Coding superstitions
Select or Download Code
Re: Re: Re: (crazyinsomniac) Re: Coding superstitions
by n3dst4 (Scribe) on Jan 09, 2002 at 04:27 UTC
    Well caught; the class was actually in Java, but I transliterated the example.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-12-26 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls