in reply to Re: Surprising Precedence/Context
in thread Surprising Precedence/Context
That must explain this too,
#!/usr/bin/perl use strict; use warnings; sub returnsTrueButExpectedFalse {return 1 and 0} die if 1 and 0; #does not die, but die if returnsTrueButExpectedFalse(); #does die here, surprisingly
B::Deparse shows the return statement as this,
(return(1) and 0);
which isn't quite enough to say the return(1) happens before the 0 is evaluated. That must be what's happening though, from your reminder about flow control and and.
Thanks for the tip about B::Deparse.
Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Surprising Precedence/Context ("and" is "if")
by LanX (Saint) on Jun 02, 2017 at 20:11 UTC |