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

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

by ikegami (Patriarch)
on Apr 07, 2009 at 17:09 UTC ( [id://756084]=note: print w/replies, xml ) Need Help??


in reply to Re^4: What is the difference between $array[1] and @array[1]?
in thread What is the difference between $array[1] and @array[1]?

I don't see any use for @a[4]. I'd want to "fetch element at index 4", but @a[4] reads as "fetch elements at indexes 4". I don't have any problems with it warning.

(Syntax and/or semantics are different in Perl6. This only applies to Perl5.)

Replies are listed 'Best First'.
Re^6: What is the difference between $array[1] and @array[1]?
by JavaFan (Canon) on Apr 07, 2009 at 21:21 UTC
    I do. It makes the one element list an exception (with an exception to the exception if said list has a trailing comma).
    @a[1,2,3,4]; # Ok. @a[1,2,3]; # Ok. @a[1,2]; # Ok. @a[1]; # Warning. @a[1,]; # Good boy, you know the secret handshake.
    You don't have a problem with that? I think it's a pointless irregularity.

      No. Never used it. Never had a use for it. Never seen it used, not even in an example.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2025-01-15 05:37 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.