Q #3 - the scope of variables

来源: 2010-08-25 14:48:27 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

if (1 == 1) {
local $var1 = "foo";
my $var2 = "bar";

myprint();

}

sub myprint
{
print $var1, "n";
print $var2;
}

-------------------
Run the s-c-r-i-p-t above, you'll see the difference.