[sf-perl] Unusual Perl "feature"
kvale at phy.ucsf.edu
Fri Feb 15 16:14:25 PST 2013
On 02/15/2013 03:58 PM, Earl Ruby wrote:
> I made a typo and found a new feature.
> I have no idea what this feature is for:
>> perl -e 'use strict; my $name = - "NAME"; print "$name\n"; print "Perl prepended a minus sign to my string\n" if $name eq "-NAME";'
> Perl prepended a minus sign to my string
> Interesting behavior. Can anyone give me an example of what is this used for?
> Earl Ruby
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
This is documented behavior; see
My guess on use? As the man says, '-bareword is equivalent to the string
"-bareword"', allowing for fat comma keys without needing quotes, e.g.
(-bareword => 1, -title => 2)
More information about the SanFrancisco-pm