Well, it's a pretty nifty part of the language if you're expecting it. Some languages provide for bounds checking in the syntax and some don't. Seems like bounds checking ought to be part of the healthy code though, especially if you're relying on externally sourced data/computation.
You have to bounds check your string data to make sure it doesn't overflow from a security perspective. Why not check $index on both the sending and the receiving end? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Deighan Sent: Monday, October 16, 2006 4:27 PM To: Perl-Win32-Users@listserv.activestate.com Subject: what?!? 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 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs