Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Code blocks with ternary operator or trailing conditionals

by Plankton (Vicar)
on Feb 09, 2014 at 02:28 UTC ( #1074083=note: print w/replies, xml ) Need Help??


in reply to Code blocks with ternary operator or trailing conditionals

What errors do you get? And how about posting the actual code or part of the actual code?
  • Comment on Re: Code blocks with ternary operator or trailing conditionals

Replies are listed 'Best First'.
Re^2: Code blocks with ternary operator or trailing conditionals
by puterboy (Scribe) on Feb 09, 2014 at 02:48 UTC
    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://1074083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2020-09-28 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (144 votes). Check out past polls.

    Notices?