in reply to Re: Making each(@ary) work on 5.10?
in thread Making each(@ary) work on 5.10?
Neat! tobyink++
All I need now is something like, say feature::each_on_array, so that the code below:
use feature::each_on_array; @a = (1..1000); while (my ($idx, $item) = each @a) { }
will run on Perl 5.10 and will take no performance hit on 5.12+.
Are you interested in packaging Tie::ArrayAsHash for distribution? There's already Tie::Array::AsHash on CPAN. Perhaps rethink the name because your solution also provides aeach().
package feature::each_on_array; use strict; use warnings; use Tie::ArrayAsHash qw(aeach); sub import { return unless $^V lt 5.16.0; no strict 'refs'; my @caller = caller; *{"$caller[0]::each"} = \&aeach; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Making each(@ary) work on 5.10?
by tobyink (Canon) on Jul 27, 2012 at 07:03 UTC | |
by sedusedan (Pilgrim) on Jul 27, 2012 at 09:00 UTC | |
by tobyink (Canon) on Jul 27, 2012 at 13:10 UTC | |
by sedusedan (Pilgrim) on Jul 27, 2012 at 14:08 UTC | |
by tobyink (Canon) on Jul 28, 2012 at 09:48 UTC | |
by Anonymous Monk on Jul 27, 2012 at 07:44 UTC | |
by tobyink (Canon) on Jul 27, 2012 at 12:36 UTC |