- or download this
foreach $symname (sort keys %main::) {
local *sym = $main::{$symname};
...
print "\@$symname is nonnull\n" if @sym;
print "\%$symname is nonnull\n" if %sym;
}
- or download this
hossman@slate:~/tmp/9780596004927/programming_perl_examples [master] $
+ perl -E "say $^V"
v5.26.1
- or download this
hossman@slate:~/tmp/9780596004927/programming_perl_examples [master] $
+ perl ./program_listings/ch10/ch10.002.pl
is defined
...
$symname is defined
%utf8:: is nonnull
%version:: is nonnull
- or download this
hossman@slate:~/tmp/9780596004927/programming_perl_examples [master] $
+ perl -Mwarnings -Mstrict ./program_listings/ch10/ch10.002.pl
Variable "$sym" is not imported at ./program_listings/ch10/ch10.002.pl
+ line 3.
...
Global symbol "$symname" requires explicit package name (did you forge
+t to declare "my $symname"?) at ./program_listings/ch10/ch10.002.pl l
+ine 5.
Global symbol "%sym" requires explicit package name (did you forget to
+ declare "my %sym"?) at ./program_listings/ch10/ch10.002.pl line 5.
Execution of ./program_listings/ch10/ch10.002.pl aborted due to compil
+ation errors.