in reply to difference between @, $

I like choroba's answer, it's exactly the way it works. On a theoretical note:
* List/Array assignment: @list=('el1','el2','el3');
(Note, the parenthesis indicate that a regular array initialisation is being carried out.)
* Array Reference Assignment: $aref=['el1','el2','el3']
(Note, the scalar variable $aref is being assigned a reference to a list, enclosed in square brackets).

Enjoy!

Replies are listed 'Best First'.
Re^2: difference between @, $
by JavaFan (Canon) on Dec 07, 2011 at 17:30 UTC
    Note, the parenthesis indicate that a regular array initialisation is being carried out.
    Eh, no. The list assignment actually stems from the LHS of the assignment being an array, not from the RHS having parens. The parens are needed because the comma has a lower precedence than the assignment operator.
    $a = (1, 2); # Parens, but scalar assignment @a = 1; # No parens, but list assignment