Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Push array into array of arrays

by learnedbyerror (Monk)
on Dec 19, 2018 at 13:03 UTC ( [id://1227460]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found