This happens when the array has no elements. index -1 means the last array element, and when the array is empty, the last element is not element 0, its undefined. I asked the exact same question a while ago, theres a thread that i originated. If i feel so motivated later, i'll dig it up, otherwise check out my profile. Merlyn gave a wonderful explanation. Heres code to deal with your situation:
if ( @x ) {
$x[-1]->meth();
}
else {
die "no elements in \@x\n"; # r whatever
}
Heres the thread:
array index -1 oddity