Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: What is the difference between $array[1] and @array[1]?

by moritz (Cardinal)
on Apr 07, 2009 at 14:08 UTC ( [id://756031]=note: print w/replies, xml ) Need Help??


in reply to What is the difference between $array[1] and @array[1]?

The context, and that the second one warns when warnings are in effect:
$ perl -E 'sub w { say wantarray ? "list" : "item" }; @a[0] = w(); $a[ +0] = w()' list item

(Update: slightly clearer code)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2025-01-15 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (46 votes). Check out past polls.