in reply to Re: Push array into array of arrays
in thread Push array into array of arrays

I don't think there are special meanings for "@a" and "@b", I think you may be thinking about "$a" and "$b" which are identified as special variable for use in perl sort, see perlvar. perlcritic will create a message "Magic variable "@a" should be assigned as "local" at line..."; however, I am not aware of and cannot find any reference to "@a" or "@b" as being a magic variable

Please explain if I am missing something!

Cheers, lbe

Replies are listed 'Best First'.
Re^3: Push array into array of arrays
by Marshall (Canon) on Dec 20, 2018 at 03:32 UTC
    Hi Ibe,
    You have this completely right!

    My advice was over simplified.
    In Perl, the various sigils (example: %,$,@) have their own namespaces.

    Yes, it is possible to have @x and $x or even %x to be distinct things.
    $a is different than @a.

    I do not believe that using the same alphanumeric name for a hash, array or scalar is a good idea.
    Not everything that is allowed by Perl is "good idea".

    I recommend and advise avoiding using "a" or "b" for any kind of user variable.
    Consider $a[1] -- that accesses @a instead of the $a scalar. This can be confusing.

    I stand by my recommendation to avoid any user variable named "a" or "b" or using the same string to define things like: %xyz, $xyz, @xyz.
    Use different names for these very different things.