There is no '4' element in $array
for you to access. $array
is the string "4601". It is not an array (or an array reference), exactly like the error message you quoted says:
Can't use string ("4601") as an ARRAY ref
Because it is not an array, it has no elements for you to access.
Perhaps you're coming from C and assuming that strings are arrays of characters? If so, then you need to understand that they aren't. In Perl, a string is a basic data type. A single value. Not an array of characters.