cheruvim has asked for the wisdom of the Perl Monks concerning the following question:
Can someone explain to me why this is. Is the ternary operator some kind of list operator in disguise? Why does the context of shift need to be so explicit.
if someone can point to the book that explains this, I would be greatful, otherwise it's a bug in my eyes because '?' is an operator and the interpretor upon hitting that operator as such and not a token should decipher the context of the shift.# WRONG! at least in 5.8.5 - context is ambiguous? my $thing = shift ? 1: 0 #RIGHT! $thing = shift() ? 1 : 0
Oct 05, 2025 at 07:30 UTC McDarren Moved from Snippets Section to SOPW
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Use of shift in Ternary Operator
by hipowls (Curate) on Mar 22, 2008 at 23:00 UTC | |
Re: Use of shift in Ternary Operator
by jwkrahn (Abbot) on Mar 22, 2008 at 19:38 UTC |