Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am a little confused with perl subroutines.
Can anybody explains the differences in ways to call subroutines for me.
what is the best practice to use, when and why?sub Test { my ($X,$Y) = @_; return "Hello $X and $Y\n"; } print "With &\n"; print &Test('name 1','name 2'); print "Without &\n"; print Test('name 1','name 2'); print "Without brackets\n"; print Test 'name 1','name 2';
Thanks in advance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl Subroutines Call
by ph0enix (Friar) on Jan 05, 2010 at 11:07 UTC | |
Re: Perl Subroutines Call
by herveus (Prior) on Jan 05, 2010 at 12:38 UTC | |
Re: Perl Subroutines Call
by amir_e_a (Hermit) on Jan 05, 2010 at 15:53 UTC |
Back to
Seekers of Perl Wisdom