Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by TimToady (Parson)
on Apr 07, 2009 at 16:12 UTC ( #756063=note: print w/replies, xml ) Need Help??


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

Another mental tidbit: to prevent just this sort of confusion, Perl 6 makes sigils invariant, so that $array[1] always dereferences $array and @array[1] always deferences @array. (And in either case, slices arise naturally when you use multiple subscripts.)

So in Perl 6, not only does @array[1] not warn, but it's actually the correct form to dereference @array. The ramifications of this run deep, so I tend to doubt whether this feature will ever be backported to Perl 5, but you never know...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://756063]
help
Chatterbox?
LanX leaves with a song of the Chjuman League
[ambrus]: LanX: that's funny because it's actually the upper class that sleep in hotels, so they're the ones who should know how it's pronounced
[LanX]: h is mute in French (and most other romanic languages)
[LanX]: https://en. oxforddictionaries .com/explore/words -with-silent-h
[LanX]: it's 'orrible zis langage...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2017-03-27 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (321 votes). Check out past polls.