RE: Confusion on @array vs $array[] vs $array

2002-12-18 Thread Scot Robnett
I don't know that I'd agree with the assessment @ = ordered list % = unordered list That's a bit confusing. It's true that a hash (or associative array) uses its own sort order unless you use the 'sort' option. But an array is a simple list of elements, whereas a hash is an assoc

Re: Confusion on @array vs $array[] vs $array

2002-12-18 Thread Mark Bergeron
I can see where you're coming from on this. However the most obvious reason is that perl has no relationship in scalar context between @somename and %somename. Your question regarding the "special" $ is not germane to this concept. Each element of the array is a separate scalar variable, accesse

Re: Confusion on @array vs $array[] vs $array

2002-12-18 Thread WilliamGunther
In a message dated 12/18/2002 12:13:38 PM Eastern Standard Time, [EMAIL PROTECTED] writes: > > Anyway, perhaps one of you syntactical thought police could give me some > insights to the rational. I find it very confusing that the $ and @ > characters > are supposed to be used interchangeably

Re: Confusion on @array vs $array[] vs $array

2002-12-18 Thread Octavian Rasnita
@var is an array $var is a scalar $var[0] is also a scalar even though is an array element. @var[0] is an array which contains more array elements, but in this case it contains just a single element. To create an array slice with more elements, you'll need something like @var[0 .. n] You need to

RE: Confusion on @array vs $array[] vs $array

2002-12-18 Thread Scot Robnett
My understanding is that it's simpler than that. @ means list and $ means scalar, and essentially one element in a list is really a scalar. $foo[0] gets you the first scalar from the list @foo. $count = scalar(@foo); gets you a count of all the elements in the list. At least to me the @/$

Confusion on @array vs $array[] vs $array

2002-12-18 Thread Lance Murray
Hello: I have been fairly confused on the intermixing of array naming standards. If I understand correctly, the @array syntaxt is used to refer to the whole array, while $array[n] is refered to specific elements. In my thinking, it would have been less confusing to use @array[n] to address speci