basic query
hi all,
I just wanted to clear my confusion about a very basic thing. When you call subroutine in perl i have seen people using two ways.
sub_name()
&sub_name()
how there two routine call differs i mean when one will use & to call function in perl.
Kindly clarify.
Regards
SitePoint Wizard
While there are differences in the two methods, for the most part you can ignore them. But if you are interested it is explained in perlsub. The explanation is pretty technical however and unless you understand about references, @_, and prototypes, it may not make much sense.
http://perldoc.perl.org/perlsub.html
The recommended way with any modern perl version (not sure about perl 6 though) is all lowercase with parenthesis:
foo()
mixed case with parenthesis is very common:
FooBar()
what to avoid:
all lowercase no parenthesis:
foo (for builtin perl functions and keywords and such)
all uppercase no parenthesis:
FOO (for special code blocks, like BEGIN, maybe other things too)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks