rsiedl has asked for the wisdom of the Perl Monks concerning the following question:
This returns:#!/usr/bin/perl use strict; my %test = (); $test{11} = "reagen"; $test{26} = "daniel"; $test{13} = "joe"; foreach my $id (sort keys %test) { print "$id :: $test{$id}\n"; # Delete joe from the hash delete $test{13} if ($test{13}); } # end-foreach exit;
11 :: reagen 13 :: 26 :: danielBut I would like to remove the id as well...?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: delete hash key while hash in use
by ikegami (Patriarch) on Jul 27, 2006 at 02:18 UTC | |
|
Re: delete hash key while hash in use
by GrandFather (Saint) on Jul 27, 2006 at 02:52 UTC | |
|
Re: delete hash key while hash in use
by planetscape (Chancellor) on Jul 27, 2006 at 06:39 UTC | |
|
Re: delete hash key while hash in use
by rhesa (Vicar) on Jul 27, 2006 at 02:14 UTC |