#!/usr/bin/perl #********************************************************* # Example of the local function # # by Al Bento # Declares the argv variable as local. Changes it and # prints both the local and the global values of argv #********************************************************* # assign values to variables $q=13; @argv=(5,7,8); # assign local value to argv and prints if ($q > 10) { local @argv =@argv; shift @argv; print "local value of argv\n"; foreach $a (@argv) { print "$a\n"; } } # what happens here is outside of the local block print "global value of argv\n"; foreach $a (@argv) { print "$a\n"; }