Hi I have got another explanation that Using & means that it's a user defined subroutine. For example:
&print is a user define print and will not use Perls print function.
Also, if you don't specify the "&", subroutines must be defined before you make a call to it.
But from PErl Best Practise:
sub lock{
my ($file)=@_;
print " user defined lock\n";
}
sub link{
my ($text, $url) =@_;
print " user defined link $text $url\n";
}
print "calling lock: ".lock; #calls locl, built-in lock hidden;
print "calling &lock: ".&lock; # calls user defined lock
print "calling &link: ".&link("123","123"); # user defined link
print "calling &link: ".&link; #user defined won't print 123
print "calling link: ".link("123","123"); # built-in link
So my question: is this a strong case for using &?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.