NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
make use of the indices of the $tiers (Score:1)
use strict;
use warnings;
use Data::Dumper;
my $hash = {};
set_multi_level_hash($hash, [qw/ a b c d
print Dumper $hash;
sub set_multi_level_hash
{
my ( $hash, $tiers, $value ) = @_;
for (0
{
$hash->{$tiers->[$_]} ||= ( $_ == $#$t
Re:make use of the indices of the $tiers (Score:1)
$hash->{$tiers->[$_]} = {} unless exists $hash->{$tiers->[$_]};
$hash->{$tiers->[$_]} = $value if $_ == $#$tiers;
Reply to This
Parent