opaltoot has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
Certain purveyors of half truths have led me to believe that the "? :" syntax and the "if then else" syntax spring from the same goodly source. yet i say one is a calumny of the very perl itself. to wit :-
my $a = 'a'; my $b = 'b'; 1 ? $a = 2 : $b = 'x'; print "a is $a\n"; print "b is $b\n";
outputs
a is x b is b
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ternary conditional help
by tybalt89 (Monsignor) on Nov 28, 2016 at 20:34 UTC | |
by opaltoot (Novice) on Nov 28, 2016 at 20:43 UTC | |
by haukex (Archbishop) on Nov 28, 2016 at 20:46 UTC | |
by opaltoot (Novice) on Nov 28, 2016 at 20:49 UTC | |
by tybalt89 (Monsignor) on Nov 28, 2016 at 20:50 UTC | |
by davido (Cardinal) on Nov 28, 2016 at 21:16 UTC | |
by tye (Sage) on Nov 28, 2016 at 21:39 UTC | |
by ikegami (Patriarch) on Nov 29, 2016 at 20:45 UTC | |
Re: ternary conditional help
by haukex (Archbishop) on Nov 28, 2016 at 20:42 UTC | |
Re: ternary conditional help (style)
by tye (Sage) on Nov 28, 2016 at 21:57 UTC | |
Re: ternary conditional help
by AnomalousMonk (Archbishop) on Nov 29, 2016 at 00:25 UTC | |
Re: ternary conditional help
by BillKSmith (Monsignor) on Nov 29, 2016 at 03:59 UTC |
Back to
Seekers of Perl Wisdom