http://qs1969.pair.com?node_id=376482


in reply to When is => ne , (warning rather arcane and possibly totally useless)

Perhaps I'm just being thick, and there is something much more subtle going on here that I am missing, but isn't that exactly the documented difference between ',' and '=>'? From perldoc perlop (emphasis mine):

The => digraph is mostly just a synonym for the comma operator. It's useful for documenting arguments that come in pairs. As of release 5.001, it also forces any word to the left of it to be interpreted as a string.

So the statement 'use => strict' is a 2-element list in void context, whereas using a comma allows 'use' to be interpreted as a keyword, thus the syntax error...

--
edan

  • Comment on Re: When is => ne , (warning rather arcane and possibly totally useless)

Replies are listed 'Best First'.
Re^2: When is => ne , (warning rather arcane and possibly totally useless)
by bunnyman (Hermit) on Jul 22, 2004 at 15:08 UTC

    I agree. When the string is made explicit, it does not change the result:

    perl -MO=Deparse -e "'use', 'strict'" '???', '???'; -e syntax OK perl -MO=Deparse -e "'use'=> 'strict'" '???', '???'; -e syntax OK