zentara has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; my %info = ( level_a => { 1 => { name => "a", loc => "b", }, }, level_b => { 2 => { name => "c", loc => "d", }, }, level_c => { 3 => { name => "e", loc => "f", } } ); delete $info{'level_b'} or warn $!; #the following delete creates $info{'level_b'}{2} ?? delete $info{'level_b'}{2}{'name'} or warn $!; #delete $info{'level_b'} or warn $!; #works fine print Dumper(%info);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleting a hash key can create one?
by Roger (Parson) on Feb 04, 2004 at 01:37 UTC | |
|
Re: deleting a hash key can create one?
by jdtoronto (Prior) on Feb 04, 2004 at 05:26 UTC | |
|
Re: deleting a hash key can create one?
by zentara (Cardinal) on Feb 04, 2004 at 15:44 UTC |