array question (newbie)



Having an array:

@mylist=("apples", "oranges", "bananas");

And refering to a particular element, which syntax is correct? (or are both
correct)?

print "Item 2 is $mylist[1]\n";
or
print "Item 2 is @mylist[1]\n";

Both seem to work, and looking at other code, I see it done both ways.


.



Relevant Pages

  • Re: array question (newbie)
    ... > Having an array: ... > And refering to a particular element, which syntax is correct? ... at the top of your program and perl will tell you which is correct. ...
    (comp.lang.perl.misc)
  • Newbie struggling with function pointers
    ... And I have an array of what I _hope_ are pointers to functions (if they ... trying to decipher all the tutorials on function pointers I've come ... The syntax, not so clear... ... Prev by Date: ...
    (comp.lang.c)
  • Re: Converting from ArrayList to non System.Type array
    ... Jack Addington wrote: ... > I have a method that takes an array of nodes as a parameter. ... > and pass to the method but I cannot seem to get the syntax right. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Datalist control is bound by an element of the array ???
    ... Data displayed on the datalist control is bound by the column name of the ... Could I use an element of the array which has the name ... Is there anything wrong with the syntax? ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • newbie question vb.net bits
    ... If I have a 2 byte byte array, how do I test bits within the bytes to ... syntax or how to get to this level. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)