in reply to Re: setting values in anonymous hash
in thread setting values in anonymous hash
> %new_hash = map {defined($_) ? $_ : ''} %{$ref2};In recent versions of Perl, you can also use a simpler version that modifies the hash in place:
This is comparable in simplicity to the original code that involved an array instead of a hash.map { $_ = '' unless defined } %$ref2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: setting values in anonymous hash
by merlyn (Sage) on Nov 28, 2000 at 21:53 UTC | |
by Dominus (Parson) on Nov 28, 2000 at 22:37 UTC | |
by extremely (Priest) on Nov 29, 2000 at 06:36 UTC | |
by mwp (Hermit) on Dec 18, 2000 at 15:15 UTC | |
by chipmunk (Parson) on Dec 18, 2000 at 19:43 UTC | |
|
Re: Re: setting values in anonymous hash
by snax (Hermit) on Nov 28, 2000 at 22:03 UTC | |
by Dominus (Parson) on Nov 28, 2000 at 22:27 UTC | |
by snax (Hermit) on Nov 28, 2000 at 22:40 UTC | |
by Dominus (Parson) on Nov 28, 2000 at 23:26 UTC | |
by snax (Hermit) on Nov 28, 2000 at 23:43 UTC |