# File: sub2.pl # Title: Use subroutine double() # Asks for a number returns double # Do this until you want to. Continue(y/n)? = # Author: Mihaela Malita # Input a number? 5 # 10 # I do not know N # Bye print double(); # invoke subroutine double() print "\nI do not know N: ",$n; #N is local in the subroutine print "Bye"; exit; ### Subroutine: Local vs Global variables sub double { print "Input a number? "; my $n = ; #declare N as local variable chop($n); return $n * 2; }