Bug#611488: addition to 'How do I process an entire hash?'

jidanni at jidanni.org jidanni at jidanni.org
Wed Jan 26 00:21:36 UTC 2011


Package: perl-doc
Version: 5.10.1-17
Severity: wishlist
File: /usr/share/perl/5.10.1/pod/perlfaq4.pod

I have an addition to 'How do I process an entire hash?':

To make all the values undefined, one can use
@hash{ keys %hash } = ();

Proof: run

#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use Data::Dumper;
my %hash = qw/a 1 b 2/;
print Dumper( \%hash );
@hash{ keys %hash } = ();
print Dumper( \%hash );

(Maybe there is even a better way?)






More information about the Perl-maintainers mailing list