in reply to Re: Interesting Use for "state" Variables
in thread Interesting Use for "state" Variables
Python has enumerate for this. For example:
The nearest thing I can find to that in Perl is the List::MoreUtils pairwise function, something like:for i, item in enumerate(array): do_something_with(item, i)
or perhaps the CPAN Array::Each::Override module.my @idx = 0 .. $#array; pairwise { do_something_with($b, $a) } @idx, @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Interesting Use for "state" Variables
by BrowserUk (Patriarch) on Mar 10, 2009 at 20:23 UTC |