You are confused.

@array[$x,$y] returns and array of the two elements of @array with indexes $x an $y.

@array[$x..$y] returns and array of the elements between index $x and $y, includive.

--
  Simon Oliver

Bennett Haselton wrote:
> 
> Presumably affects all versions of perl -- but how come if you run:
> 
> @array = ('a', 'b', 'c');
> print join(" ", @array[0,0]), "\n";
> 
> you get an array with *two* elements, i.e. the script prints "a a"?
> 
> @array[0,0] ought to return an array with *one* element, with that element
> being $array[0].  This would be consistent with the properties of arrays
> that are returned for @array[x,y] when y > x -- i.e., the number of
> elements is y - x + 1.
> 
> I guess it's up to the language designers, but I think it was a bad
> decision.  It's one more special case that you have to check for, because
> it's inconsistent behavior.
> 
>         -Bennett
> 
> [EMAIL PROTECTED]     http://www.peacefire.org
> (425) 649 9024
> 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to