Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Useless unless

by Anonymous Monk
on Aug 08, 2005 at 16:03 UTC ( [id://481922]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Useless unless
in thread Useless unless

Yes, expressions spanning statements would be unprecedented. And the 'otherwise EXPRESSION;' construct would be an syntax construct spanning statement, which also would be unprecedented. And it's omision doesn't contradict Perls philosophy - I bet Larry's first reaction would be:

What would
print "Hello"; otherwise print "world";
do?
And the smartass who would say otherwise looks at the last expression evaluated, and hence would only print "Hello", as print returns 1, I'd like to point that in such a case:
$x = 0 if 3 > 2; print "foo" otherwise;
will both assign 0 to $x, and print "foo" - as the assignment to $x is the last expression evaluated.

Replies are listed 'Best First'.
Re^4: Useless unless
by jdporter (Paladin) on Aug 08, 2005 at 17:20 UTC
    an syntax construct spanning statement
    I'm not sure what that is supposed to mean.
    it's
    its
    Perls
    Perl's
    I bet Larry's first reaction would be
    Guessing Larry's reaction is a game some of us know better than to play.
    What would ... do?
    It would raise a compile error.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found