#### prints nothing. Why??? It doesn't test against $. and it doesn't just test the value $x
$x is not a constant expression, so $. doesn't come into play. You're right about that bit.
But you're wrong about it not just testing $x. The reason it never prints anything is that it flips again as soon as it flops since $x is always true.
my $x=1; for(1,2,3,4,5) { next if (printf("flip at %s? %s\n",$_,$x?'yes':'no'),$x) .. (printf("flop at %s? %s\n",$_,$x?'yes':'no'),$x); print "$_\n"; }
flip at 1? yes flop at 1? yes flip at 2? yes flop at 2? yes flip at 3? yes flop at 3? yes flip at 4? yes flop at 4? yes flip at 5? yes flop at 5? yes
In reply to Re^4: When doesn't the flip-flop operator work in all scalar contexts?
by ikegami
in thread Why doesn't the flip-flop operator work in all scalar contexts?
by siracusa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |