sub bye { print "Bye $name\n"; $name="Tom"; } $name="Tom"; print "Hello to you and yours!\n"; &bye; print "Out of the subroutine. Hello $name.\n";# $name is now Tom &bye;