John W. Krahn wrote:
Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
my() happens when the code is compiled so it is *not* re-run every
time through the loop. The assignment happens when the code is run
so it is re-run every time.
$ perl -e '
for (1..5) {
my $count;
$count += 1;
print $count;
last if $count == 3;
}
print "\n";
'
11111
I don't understand what you are trying to demonstrate with that code?
That my() also happens at run-time,
And how does your code demonstrate that?
I believe it's self-speaking, provided that you realize what the output
would have been without the my() statement (or with the my() statement
placed before the loop). What's your point?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/