Why is $var unavailable (out of scope ?) to write when declared with my, if its scope is pretty much package-level ?
package ASDF;
use warnings;
use strict;
use feature 'say';
my $var = 'foo';
format =
@<<<<< @>>>>>
'test : ', $var
.
sub test {
say $var;
write;
}
1;
Called with :
perl -wE 'use ASDF; ASDF::test();'
Produces :
foo
Variable "$var" is not available at ASDF.pm line 16.
Use of uninitialized value $var in formline at ASDF.pm line 10.
test :
It appears otherwise available to say in the same scope ...
Replacing my with our fixes it :
foo
test : foo
Why can't write pick-up on $var correctly ?
Is it a scope issue, or an issue with how Perl's write or format is implemented ?