in reply to difference between @, $

@a is an array, or potentially a set of values, while $a is a scalar, or single value. In this case, $a is being used to hold a reference to an array, but the reference is still a single value. I think you probably intended to assign the array values in list context, rather than just adding a reference:

@a = ['1','2','3','4']; ### NO @a = ('1','2','3','4'); ### YES print $_ for @a; ### Prints 1234 print $a[0]; ### Prints 1 ### Note that you use $ and not @ when referring to a ### single item in the array $a = ['1','2','3','4']; print $_ for @$a; ### Prints 1234 print $a->[0]; ### Prints 1 ### The -> is used when it's a reference to an array