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
In reply to Re: Array to nested hash
by Limbic~Region
in thread Array to nested hash
by amw1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |