#!/usr/local/apps/perl/bin/perl sub foo { my( $i ); # "lexical scoping" (stack allocation, ie: C) # This scope's $i is no longer bound to enclosing scope's $i $i = 2; print "i = $i\n"; print "i = " . $main::i . "\n"; } $i = 1; &foo; print "i = $i\n";