in reply to What does the dash before hash assignment means?
fun(-url => $httpRefer ); is not a “hash assignment.” The => symbol in this case is equivalent to a comma. Subroutine fun is being called with an argument-list containing two arguments: -url, and the value of $httpRefer.
Some subroutines are written to recognize and to assign particular meanings to parameters which begin with a dash, e.g. to disambiguate user-chosen arbitrary strings which otherwise might match “real” parameters for the function. (I, the author, decree that ... “Anything beginning with a dash is a literal.”) But, that is up to their authors, not Perl itself.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does the dash before hash assignment means?
by karlgoethebier (Abbot) on Sep 03, 2013 at 13:50 UTC | |
by Corion (Patriarch) on Sep 03, 2013 at 13:57 UTC | |
by karlgoethebier (Abbot) on Sep 03, 2013 at 14:05 UTC |