in reply to Deleting undef values from a hash
Doesn't work for tied hashes or magic hashes such as %SIG or %ENV.#!/usr/bin/perl -w use strict; use warnings; our %foo; @foo{'foo','baz'} = (); for my $key ('foo','bar','baz') { print "key $key ", (\undef == \delete $foo{$key} ? "didn't exist" : "existed"), "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Deleting undef values from a hash
by tilly (Archbishop) on Dec 14, 2003 at 23:25 UTC | |
by ysth (Canon) on Dec 15, 2003 at 00:04 UTC |