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

Re: Strange interaction between print and the ternary conditional operator

by Anonymous Monk
on Feb 20, 2020 at 03:27 UTC ( #11113224=note: print w/replies, xml ) Need Help??


in reply to Strange interaction between print and the ternary conditional operator

print works like a function, so print $foo acts like print($foo). you gotta print something before the parens to make it work, like print "".(1?"y":"n")."x" or better yet use join print join "", (1?"y":"n"), "x"
  • Comment on Re: Strange interaction between print and the ternary conditional operator

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2020-05-29 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?