in reply to Missing error under strict
my is declaring $one for the rest of the scope.
say 'one' until my $one = 1;
Scope is the file because post-fix constructs have no surrounding block.
> Global symbol "$two" requires explicit package name at ./strict.pl line 16.
The scope here is limited to the loop and won't reach the say
until (my $two = 2) { say 'two'; } say $two;
> Commenting out line 16 gives me:
Then you have no compile time fatals from strict anymore and the script runs
> Use of uninitialized value $one in say at ./strict.pl line 10.
that's a run-time warning ...
... I'm a bit puzzled and need to run the code, to see why my $one is not initialized
The condition after until should be executed at least once.
I can only guess that some kind of weird optimization is happening there.
Please note that using my in conditional code is considered bad practice and might not be well tested.
You might have found a bug here.
My guess is that scope handling is wrong here.
At runtime a variable should be reset to undef at the end of it's loop-scope.
Of course this is in conflict with Perl's compile-time behavior of not seeing a scope here.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
---|