Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Alias vs Reference

by eyepopslikeamosquito (Canon)
on Jun 16, 2012 at 07:46 UTC ( #976552=note: print w/ replies, xml ) Need Help??


in reply to Alias vs Reference

Some places aliases are used:

  • $_ in foreach, map and grep and named loop variables in foreach
  • $a and $b in a sort block
  • $a and $b in List::Util's reduce function and List::MoreUtils's pairwise function
  • Each element of @_ for the actual arguments in a subroutine call
  • By packages importing symbols
  • By an our declaration, which creates a lexically scoped alias
  • You can explicitly create an alias via typeglobs

See also "alias" in perlglossary and Item 118 "Access the symbol table with typeglobs" in Effective Perl Programming.

Update: added named loop variables in foreach. Thanks Jenda.


Comment on Re: Alias vs Reference
Select or Download Code
Re^2: Alias vs Reference
by Jenda (Abbot) on Jun 16, 2012 at 09:53 UTC

    Not just $_ in foreach. Named loop variables in foreach are also aliases.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2015-07-06 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (74 votes), past polls