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.