in reply to perl error

In the line in question, you are dealing with one element of the array, which is a scalar, so you use $ not @. To demonstrate with a simpler example, @a is an array. $a[0] is the first element in the array.

"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."