On Tue, 26 Sep 2000, Nathan Wiger wrote:

> John Porter wrote:
> > 
> > Yeah, not to mention the fact that many modules, notably CGI.pm,
> > are arranged to allow to use unquoted strings of the form -name:
> > 
> >         print textfield( -name => 'description' );
> 
> Well, this one's not an issue, because => auto-quotes the LHS. It's the
> same as this:
> 
>       print textfield( "-name", 'description' );

Actually, more like this:

    print textfield( -'name', 'description' );

Try putting it through -MO=Deparse. I guess the quoting behaviour of =>
"binds" more strongly than the hyphen, so that "-name =>" is interpreted
as unary minus + bareword 'name' + big arrow, leading to unary minus +
quoted bareword 'name' + big arrow, which is equivalent to - "name" and a
comma. Fortunately, - "string" doesn't convert "string" to a number (0)
and then apply negation but results in "-string" (`perldoc perlop` says:
"If the operand is an identifier, a string consisting of a minus sign
concatenated with the identifier is returned. [...] One effect of these
rules is that `-bareword' is equivalent to `"-bareword"'."

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>

Reply via email to