in reply to How do I use strict with asub( a = 'b' ) syntax?

(your title doesn't really match up with the problem as described)

The => operator generally quotes the value on its left hand side. There are however exceptions, and you've stumbled across one of them. The automatic quoting only works when all of the characters in the key name are 'word' characters (i.e. ones that match \w in regular expressions). The string 'content-type' contains a '-' which isn't a world character. Unquoted, Perl interprets that as 'content' - 'type' which doesn't make much sense. The best way round this problem is to quote the key.

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

  • Comment on Re: How do I use strict with asub( a = 'b' ) syntax?

Replies are listed 'Best First'.
(tye)Re: How do I use strict with asub( a = 'b' ) syntax?
by tye (Sage) on Mar 15, 2001 at 19:59 UTC

    But note that -color => "red" works just fine. Unary minus has been made extra special just for this case (because of tcl syntax inherited via Tk). (:

            - tye (but my friends call me "Tye")