Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Code blocks with ternary operator or trailing conditionals

by puterboy (Scribe)
on Feb 09, 2014 at 02:48 UTC ( #1074085=note: print w/replies, xml ) Need Help??


in reply to Re: Code blocks with ternary operator or trailing conditionals
in thread Code blocks with ternary operator or trailing conditionals

perl -e 'print "hello\n" if 1' hello
vs.
perl -e '{print "hello\n"; print "bye\n"} if 1' Execution of -e aborted due to compilation errors. syntax error at -e line 1, near "if 1"
And:
perl -e '1 ? print "hello1\n" : print "hello2\n" if 1' hello1
vs.
perl -e '1 ? {print "hello1\n"; print "bye1\n"} : {print "hello2\n"; p +rint "bye2\n"}' syntax error at -e line 1, near "; print" syntax error at -e line 1, near ""bye2\n"}" Execution of -e aborted due to compilation errors.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074085]
help
Chatterbox?
[1nickt]: Sorry kgb can't help there, not a perltidy user.
[marto]: evening all
[Happy-the-monk]: good evening!

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-11-18 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?