Perl Monk, Perl Meditation | |
PerlMonks |
Re: Perl: last evaluated value as a returned value for a subroutine. See insideby moritz (Cardinal) |
on Feb 21, 2013 at 17:18 UTC ( [id://1019988]=note: print w/replies, xml ) | Need Help?? |
My question is: are there any conditions when Perl would NOT print "some string" in last two lines of code? I have trouble making sense of this question. If you change the code, it might do something differently, depending on how you change it. If you don't change the code, it'll do the same thing each time you execute it. If the fact that $R is returned surprises you, it might help to know that
is actually compiled the same as
(and likewise if ($a) { $b } is compiled the same as $a and $b) which is why branching constructs as the last statement return the value of the conditional.
In Section
Seekers of Perl Wisdom
|
|