[sf-perl] Unusual Perl "feature"

Uri Guttman uri at stemsystems.com
Mon Feb 18 13:09:11 PST 2013


On 02/17/2013 09:40 PM, Quinn Weaver wrote:
> On Feb 15, 2013, at 4:14 PM, Mark Kvale wrote:
>
>> This is documented behavior; see
>>
>> http://perldoc.perl.org/perlop.html#Symbolic-Unary-Operators
>>
>> 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)
>
> But you don't need to quote keys anyway. This feature must exist for some other reason.
>

it was allowed because of perl/tk where all the keys (as in regular tk) 
are -foo style. so perl allows barewords of -foo to be autoquoted by =>. 
  this also allowed the - prefix to be a simple prefix - to the string 
op which is useful for those types of keys.

uri


More information about the SanFrancisco-pm mailing list