<?xml version="1.0" encoding="windows-1252"?>
<node id="1019982" title="Perl: last evaluated value as a returned value for a subroutine. See inside" created="2013-02-21 11:52:26" updated="2013-02-21 11:52:26">
<type id="115">
perlquestion</type>
<author id="1001991">
Doctrin</author>
<data>
<field name="doctext">
Hello dear Monks again!

I have some code:
&lt;code&gt;
use strict;
my $R;

sub mySub {
	unless ($R) {
		print "CONDITION WORKS\n";
		$R = 'some string';
	}
}

print mySub(); #prints CONDITION WORKS\nsome string
print mySub(); #prints some string
print mySub(); #again
&lt;/code&gt;

So, Perl returns last evaluated value. My question is: are there any conditions when Perl would NOT print "some string" in last two lines of code?

Thanks!</field>
</data>
</node>
