#!/usr/local/bin/perl
#this script gives examples of how local varaibles are used
 
use warnings;

$bar=10;

sub myprint {
   print "**************\n";
   print "$bar\n";
   print "**************\n";
}


sub test1 {
   myprint;
}

sub test2 {
   local($bar)=100;
   myprint;
}


sub test3 {
   my $bar=1000;
   myprint;
}

test1; #prints 10
test2; #prints 100
test1; #prints 10
test3; #prints 10