Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: (crazyinsomniac) Re: Coding superstitions

by blakem (Monsignor)
on Jan 09, 2002 at 00:24 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://137242]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-18 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found