# File: sub0.pl # Title: Use subroutine greetings(), sayHi(int), # Author: Mihaela Malita # I am a subroutine without any parameters # I do not return anything # Bye greetings(); # invoke subroutine greetings() sayHi(5); # say Hi 5 times. Calls subroutine print "Bye"; exit; ############ subroutine needs a name and a body {} sub greetings { print "I am a subroutine without any parameters\n"; print "I do not return anything"; return; } ############ subroutine has 1 parameter, but does not return anything sub sayHi { my($many) = @_; # array of arguments take first print "One parameter:" ,$many; for (1..$many) { print "Hi "; } return; }