Help for this page

Select Code to Download


  1. or download this
    # this breaks if @pathparts has a double quote in it!
    my $element = '$hash' . join '', map { qq|{"$_"}| } @pathparts;
    eval "$element = undef";
    
  2. or download this
    my $step = \%hash;
    while ( my $part = shift $pathparts ) {
        $step->{$part} ||= {};
        $step = $step->{$part};
    }