in reply to Why so strict?
To better understand how Perl parses your code, run:
and you will see something like:perl -MO=Deparse,-p yourscript.pl
That is, the return value of say (which will almost certainly be the value one) is always being assigned to $c! I doubt that is what you want. To see that more clearly, print out the value of $c after your assignment statement.my($c); ($c = (&func() ? say("$c found!") : say('None!')));
See also: Surprised by Perl parse of ternary operator.
|
|---|