JupiterCrash has asked for the wisdom of the Perl Monks concerning the following question:
Doesn't Perl have a fancy word for its behavior where you can iterate through an array/list, and modifying the iterator variable modifies the array that you are iterating through? eg.
my @ar = (1, 2, 3); foreach my $a (@ar) { $a = $a + 1; } print join ", ", @ar; # prints 2, 3, 4
I mentioned to someone how Perl has a big fancy word for this behavior and can't remember (or find through google) what it is. Now I want to know.
This is described in http://modernperlbooks.com/books/modern_perl_2014/03-perl-language.html, but it didn't have a fancy name: "The for loop aliases the iterator variable to the values in the iteration such that any modifications to the value of the iterator modifies the iterated value in place."
Am I imagining that there is a fancy word for this behavior?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A specific term for a Perlism
by choroba (Cardinal) on Mar 19, 2015 at 16:11 UTC | |
by JupiterCrash (Monk) on Mar 19, 2015 at 16:29 UTC | |
by Anonymous Monk on Mar 19, 2015 at 16:34 UTC | |
by JupiterCrash (Monk) on Mar 19, 2015 at 16:46 UTC | |
by AnomalousMonk (Archbishop) on Mar 19, 2015 at 18:02 UTC | |
| |
|
Re: A specific term for a Perlism (alias types)
by LanX (Saint) on Mar 19, 2015 at 18:28 UTC | |
|
Re: A specific term for a Perlism
by jeffa (Bishop) on Mar 19, 2015 at 16:42 UTC | |
by AnomalousMonk (Archbishop) on Mar 19, 2015 at 19:47 UTC | |
by Anonymous Monk on Mar 19, 2015 at 18:16 UTC | |
|
Re: A specific term for a Perlism
by AppleFritter (Vicar) on Mar 19, 2015 at 17:56 UTC | |
|
Re: A specific term for a Perlism
by JupiterCrash (Monk) on Mar 19, 2015 at 18:28 UTC |