in reply to Array to hash refs
Hehehe, i waited until Abigail-II posted first though. Now i am going to spend some time figuring out how that works ... need more coffee!use strict; my @a = ('a'..'f'); my $hash; my $last = 1; for (reverse @a) { $hash->{$_} = $last; $last = {$_ => $hash->{$_}}; } delete $hash->{$a[$_]} for (1..@a);
UPDATE: Ok, let's figure Abigail-II's code out ...
When dealing with loops, a good way to understand the code is to chart out what happens at each iteration -
UPDATE*2:
I think i like Anony's answer the best ...
now that is using Perl to write Perl! /smack forehead
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Array to hash refs
by Abigail-II (Bishop) on Aug 14, 2002 at 09:18 UTC |