[oak perl] corrected lexical script

Sandy Santra santranyc at yahoo.com
Sat Feb 5 02:16:45 PST 2005


There were so many holes in that piece of code I last posted that I want to 
crawl under a rock.  Here's a slight revision, although this wouldn't work 
if it had "use strict" in it, either:

#TEST1 -- lexical trumps package
{sub standard {
         my $x = red;
         print "$x\n";
}
&standard; # should print red
}
print "$x\n"; # should print only newline

#TEST2 package trumps lexical
$x = pink;
print "$x\n"; # should print pink

sub marine {
         my $x = blue;
         print "$x\n"; # should print blue
}
&marine; # should print blue
print "$x\n"; # should print pink

--Sandy Santra



More information about the Oakland mailing list