my @data = (1, 2, 3);
my $index = -1;
my $val = $data[$index];
print("val = '$val'\n");


Output:
val = '3'

Now, there's a great feature. If you index before the beginning of an 
array, it neither gives you a runtime error nor returns undef. What a 
great way to end up with a program that produces incorrect data with 
a long night of debugging ahead of you trying to track that one down 
(imagine that $index is computed via a complicated function in a 
totally separate part of the code).

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to