syphilis has asked for the wisdom of the Perl Monks concerning the following question:
How is this apparent difference explained ?use strict; use warnings; my $x = '1'; my $z = "undetermined\n"; ($x) ? print "true\n" : print "false\n"; ($x) ? $z = "true\n" : $z = "false\n"; print $z; __END__ Output (on both perl-5.38.0 and perl-5.40.0): true false
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Evaluating the condition ($x)
by hv (Prior) on Aug 26, 2024 at 03:36 UTC | |
|
Re: Evaluating the condition ($x) (ternary conditional operator)
by LanX (Saint) on Aug 26, 2024 at 11:00 UTC | |
|
Re: Evaluating the condition ($x)
by Fletch (Bishop) on Aug 26, 2024 at 03:29 UTC | |
|
Re: Evaluating the condition ($x)
by talexb (Chancellor) on Aug 26, 2024 at 16:27 UTC | |
|
Re: Evaluating the condition ($x ||= $y)
by harangzsolt33 (Deacon) on Aug 26, 2024 at 03:21 UTC | |
by syphilis (Archbishop) on Aug 26, 2024 at 03:46 UTC | |
by ikegami (Patriarch) on Aug 26, 2024 at 04:14 UTC | |
by Anonymous Monk on Aug 26, 2024 at 09:31 UTC | |
by ikegami (Patriarch) on Aug 26, 2024 at 13:42 UTC | |
by tybalt89 (Monsignor) on Aug 26, 2024 at 07:53 UTC |