One way around that is to declare my $test" at (an inserted) line 2 and remove the "my" at line 5; there are other alternatives to making $test global (which is generally a bad idea).
In any case, in earlier versions of Perl, use strict; use warnings would have alerted you to this problem; since it didn't (or, "Naughty, naughty! You didn't tell us about a message on the order of 'Global symbol "$test" requires explicit package name at ....'"), I'm going to have to recheck my (mis-?) understanding that 5.12 would invoke strict unless overridden see below.
Update: Credit Corion who offered the necessary correction to my misunderstanding:
"...the implicit strictures come from use 5.12;"
brian d foy posted (to http://www.effectiveperlprogramming.com/blog/468) on the subject:
"Perl 5.12 can turn on strict for you automatically, stealing a feature from Modern::Perl that takes away one line of boilerplate in your Perl programs and modules. We talk about strict in Item 3: Enable strictures to promote better coding. Similar to what we show in Item 2: Enable new Perl features when you need them, to turn strictures on automatically, you have to use use with a version of Perl 5.11.0 or later:
use 5.012;This is really just the same thing as explicitly turning on strict and importing the 5.12 feature bundle:
use strict; use feature ':5.12';Note that this means merely importing the feature bundle does not include this implicit strictures benefit. Don’t think you’re safe merely because you are using a perl5.12 interpreter.
In reply to Re: do-while loop never exits
by ww
in thread do-while loop never exits
by IvyR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |