in reply to Building Multi-Level Hash dynamically
#!/usr/bin/perl -W use strict; my $hoh; my @array = qw|abc def ghi jkl|; my $eval_string = '$hoh->{' . (join '}{', @array) . '} = q|hello world|'; eval "$eval_string"; print $hoh->{abc}{def}{ghi}{jkl}; __END__ ___output___ hello world
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Building Multi-Level Hash dynamically
by Joost (Canon) on Dec 05, 2006 at 16:09 UTC | |
by Firefly258 (Beadle) on Dec 05, 2006 at 18:31 UTC | |
by Joost (Canon) on Dec 05, 2006 at 23:24 UTC | |
by Joost (Canon) on Dec 05, 2006 at 23:42 UTC |