#! /usr/local/bin/perl # This example will pass a value to a subroutine in a # pass-by-reference mode. $var = "Outside sub"; #make the assignment print "Before Sub: $var\n"; &PrintVar($var); #call the sub and pass-by-reference print "After Sub: $var\n"; # This is the sub that will be called sub PrintVar { $_[0] = "Inside sub"; #we do $_[0] since values are stored in @_ print "During Sub: $_[0]\n"; }