Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by edan (Curate)
on Jul 22, 2004 at 06:37 UTC ( #376482=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://376482]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2022-05-16 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (62 votes). Check out past polls.

    Notices?