Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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

Replies are listed 'Best First'.
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 about the Monastery: (5)
As of 2016-06-30 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (396 votes). Check out past polls.