Can you output the values of $! and $_ before executing to verify that they are valid?

You're using them to index an array, and if they are zero or negative, you'll get an invalid expression when you reduce them by 1, as you are doing. The problem may actually be earlier in your code, causing these values to be invalid.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D