#! /usr/local/bin/perl # This example will pass a value to a subroutine in a # pass-by-value mode. $var = "Outside sub"; #make the assignment print "Before Sub: $var\n"; &PrintVar($var); #call the sub and pass-by-value print "After Sub: $var\n"; # declare the sub and set it up sub PrintVar { local($var)=@_; $var = "Inside sub"; print "During Sub: $var\n"; }