Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Perlplexation - foreach shoulda Known

by raybies (Chaplain)
on Apr 16, 2012 at 16:34 UTC ( #965352=note: print w/replies, xml ) Need Help??


in reply to Re: Perlplexation - foreach shoulda Known
in thread Perlplexation - foreach shoulda Known

I've had Effective Perl Programming for a year now, and really enjoyed it, but for some reason missed the detail until just this last week... I was "whoah!" and decided to try out a bunch of examples. :)

So are "aliases" used in other Perl commands besides these sorts of loops? Is that what $a and $b are considered to be in the sort command?

  • Comment on Re^2: Perlplexation - foreach shoulda Known

Replies are listed 'Best First'.
Re^3: Perlplexation - foreach shoulda Known
by eyepopslikeamosquito (Chancellor) on Apr 16, 2012 at 21:09 UTC

    So are "aliases" used in other Perl commands besides these sorts of loops? Is that what $a and $b are considered to be in the sort command?
    Yes and yes. Some places aliases are used:
    • $_ in foreach, map and grep
    • $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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://965352]
help
Chatterbox?
[Corion]: ambrus: Yeah - we're in that situation too, except that there is no time to do the reorganizing :-/
[LanX]: ... so my boss started a project with the newest sun servers and invited the traders to come on weekend to test it... and they were so pleased, that they forced him to keep it in production...
[ambrus]: Corion: sure, this is the long-term plan. The short term is that I have to run this ungodly mess to get results from the new input data today.
[Corion]: ambrus: Most of our "automation" is tied to process exit codes and a shell pipeline :-\
[LanX]: ... a week later they realized that one of the databases - which recorded how much the other banks due to this bank - was not correctly plugged
[ambrus]: Corion: I have no problem with exit codes and shell pipeline. My problem is that the current process requires a lot of manual intervention from me, including editing the source codes.
[ambrus]: (Also a lot of manual intervention by two or three other co-workers, who do other parts of the process.)
[ambrus]: Some of the manual part is unavoidable, but not all.
[choroba]: LanX was there a way to recover the numbers from the remaining information?
[Corion]: LanX: Ow ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2017-03-29 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (350 votes). Check out past polls.