[sf-perl] Unusual Perl "feature"

Earl Ruby earl at ruby.org
Sat Feb 23 14:23:56 PST 2013


While this is all interesting, I wasn't using the => operator in the
example I gave, just =


On Tue, Feb 19, 2013 at 10:09 AM, Quinn Weaver <quinn at pgexperts.com> wrote:
> Nice catch! That makes total sense. I wrote a Perl/Tk app once, but I'd forgotten all about the -key convention. It Just Worked, so I never really thought about it. DWIM for the win.
>
> --
> Quinn Weaver
> PostgreSQL Experts, Inc.  http://pgexperts.com/
> 1-888-743-9778 (my extension: 510)
> Sent from my phone; pardon my brevity.
>
> On Feb 18, 2013, at 1:09 PM, Uri Guttman <uri at stemsystems.com> wrote:
>
>> 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
>> _______________________________________________
>> SanFrancisco-pm mailing list
>> SanFrancisco-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm



--
Earl Ruby
http://earlruby.org/
http://www.linkedin.com/in/earlruby
@earlruby


More information about the SanFrancisco-pm mailing list