P is for Practical | |
PerlMonks |
Re: Ways of quotingby LanX (Saint) |
on May 15, 2020 at 00:30 UTC ( [id://11116794]=note: print w/replies, xml ) | Need Help?? |
Hi IMHO the only purpose of assigning a package's name to a scalar is to handle it later in a referential or symbolic way. For instance $x->can("function") will return a code ref if "function" exists in the package. So the benefit of writing $x = anything_could_go_here:: over $x = 'anything_could_go_here' is only catching the error when misspelling the package's name. (you already demonstrated this after activating warnings ) I'd strongly discourage using this as golfing hack to avoid single quotes around normal strings.
Cheers Rolf
In Section
Meditations
|
|