[sf-perl] Unusual Perl "feature"
Sean Dodger Cannon
el.dodgero at gmail.com
Tue Feb 19 03:11:50 PST 2013
Technically those aren't barewords in your example. Everything on the
left of a => is implicitly double quotish.
On 15 February 2013 16:14, Mark Kvale <kvale at phy.ucsf.edu> wrote:
> 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
>> 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)
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
Sean "Dodger" Cannon
More information about the SanFrancisco-pm