in reply to Array to nested hash
The question is - why?#!/usr/bin/perl use strict; use warnings; my @foo = 1..5; my %hash; my $ref = \%hash; for ( 0 .. $#foo ) { $ref->{ $foo[$_] } = $_ == $#foo ? undef : {}; $ref = $ref->{ $foo[$_] }; }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array to nested hash
by tinita (Parson) on Nov 08, 2004 at 17:18 UTC | |
|
Re^2: Array to nested hash
by Mutant (Priest) on Nov 08, 2004 at 16:53 UTC | |
by amw1 (Friar) on Nov 08, 2004 at 17:20 UTC |