Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Coding superstitions

by VSarkiss (Monsignor)
on Jan 08, 2002 at 03:05 UTC ( #136990=note: print w/ replies, xml ) Need Help??


in reply to Re: Coding superstitions
in thread Coding superstitions

...those semicolons aren't necessary either (nor are the braces, now that I think about it).
You're correct about the semicolons, but the braces are necessary. The if-else construct in Perl controls BLOCKs, not statements. Take a look at perldoc:perlsyn. This avoids the dangling-else ambiguity.

Don't confuse this with the if modifier, which comes at the end of statements, not BLOCKs.

I'll let good brother tilly take you to task for (probably inadvertently) passing your current @_ when calling yes and no. ;-)


Comment on Re: Re: Coding superstitions
Select or Download Code
Replies are listed 'Best First'.
Re: Coding superstitions
by mstone (Deacon) on Jan 08, 2002 at 05:08 UTC

    -- edit: adding an interjection: D'oh!

    Well spotted..

    That's another reason to code defensively. Idioms don't necessarily port between languages, and even silence can mean something in the right place.

    FWIW, passing the current @_ is at least syntactically valid, and like so much of Perl, can be used for good or evil at one's own discretion.

Re (tilly) 3: Coding superstitions
by tilly (Archbishop) on Jan 08, 2002 at 04:44 UTC
    There is no need. Brother VSarkiss already did it for me. :-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2015-07-30 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls