On 03/09/2014 12:40 AM, Alex Chiang wrote:
Hi all,I'm a perl beginner, and when I tries to practice delete built-in, I find it's not working as I supposed to. 44 my %employ_list = ("e10220" => "Du", "e10250" => "Vic"); 45 # iterate thru with each 46 while ( my ($k, $v) = each %employ_list ) { 47 print " before: key:$k => value:$v \n"; 48 if ($k eq "e10220") { delete $employ_list{$k}; } 49 $employ_list{$k} = undef;
why did you do that assignment of undef? you just deleted the key and its value therfore you don't need to assign undef. in fact it created the key again in the hash with a value of undef.
uri -- Uri Guttman - The Perl Hunter The Best Perl Jobs, The Best Perl Hackers http://PerlHunter.com -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
