From 97631e60d57d5dff2c1fd3a99046a8e454910066 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sat, 29 Oct 2011 20:21:40 +0200 Subject: [PATCH 1/1] unconfuse strict.pm documentation my() does not localize variables, and reusing variable names is confusing too --- lib/strict.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/strict.pm b/lib/strict.pm index 053aae7..e8c25dc 100644 --- a/lib/strict.pm +++ b/lib/strict.pm @@ -92,8 +92,8 @@ is allowed so that C would not break under stricture. =item C This generates a compile-time error if you access a variable that wasn't -declared via C or C, -localized via C, or wasn't fully qualified. Because this is to avoid +declared via C, C, or C, and 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 and L. @@ -101,7 +101,7 @@ L. use strict 'vars'; $X::foo = 1; # ok, fully qualified my $foo = 10; # ok, my() var - local $foo = 9; # blows up + local $baz = 9; # blows up, $baz not declared before package Cinna; our $bar; # Declares $bar in current package -- 1.8.3.1