#!/usr/local/apps/perl/bin/perl sub foo { local( $i ); # "dynamic scoping" (global allocation, ie: FORTRAN) # This scope's $i is now temporarily bound to enclosing scope's $i $i = 2; print "i = $i\n"; print "i = " . $main::i . "\n"; } $i = 1; &foo; print "i = $i\n";