diff options
author | Tom Phoenix <rootbeer@teleport.com> | 1998-04-29 15:48:16 -0700 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-05-14 15:58:01 +0000 |
commit | 535b5725d48083aeb233abbcdfef2fd3274b2619 (patch) | |
tree | a28dda24803e56c60926ae11f1201e063ff236c6 /lib/strict.pm | |
parent | 52cebf5efc9883c776f89be24e988c47ceba2a42 (diff) | |
download | perl-535b5725d48083aeb233abbcdfef2fd3274b2619.tar.gz |
Using Getopts::* with strict vars
p4raw-id: //depot/perl@964
Diffstat (limited to 'lib/strict.pm')
-rw-r--r-- | lib/strict.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/strict.pm b/lib/strict.pm index 8492e933fd..af95b3d096 100644 --- a/lib/strict.pm +++ b/lib/strict.pm @@ -38,6 +38,7 @@ use symbolic references (see L<perlref>). =item C<strict vars> This generates a compile-time error if you access a variable that wasn't +declared via C<use vars>, localized via C<my()> or wasn't fully qualified. Because this is to avoid variable suicide problems and subtle dynamic scoping issues, a merely local() variable isn't good enough. See L<perlfunc/my> and @@ -48,6 +49,10 @@ L<perlfunc/local>. my $foo = 10; # ok, my() var local $foo = 9; # blows up + package Cinna; + use vars qw/ $bar /; # Declares $bar in current package + $bar = 'HgS'; # ok, global declared via pragma + The local() generated a compile-time error because you just touched a global name without fully qualifying it. |