in reply to Indepedent lazy iterators for the same hash?
That's what Var::Pairs is for!
#!/usr/bin/env perl use strict; use warnings; use Var::Pairs; my %hash = (foo => 1, bar => 2); for my $pair1 (pairs %hash) { for my $pair2 (pairs %hash) { printf "%s %s\n", $pair1, $pair2; } } __END__ bar => 2 bar => 2 bar => 2 foo => 1 foo => 1 bar => 2 foo => 1 foo => 1
Sadly it uses Data::Alias which is currently broken on Perl 5.18.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Indepedent lazy iterators for the same hash?
by LanX (Saint) on Jun 30, 2013 at 18:58 UTC | |
by hdb (Monsignor) on Jun 30, 2013 at 21:00 UTC | |
by AnomalousMonk (Archbishop) on Jun 30, 2013 at 20:43 UTC | |
by LanX (Saint) on Jun 30, 2013 at 21:32 UTC | |
by AnomalousMonk (Archbishop) on Jun 30, 2013 at 23:33 UTC | |
by hdb (Monsignor) on Jul 01, 2013 at 10:49 UTC | |
by LanX (Saint) on Jul 01, 2013 at 10:55 UTC |