in reply to Can I initialize/clear a hash reference?

This will do it:

sub foo { my $href = shift; %{$href} = (); $href->{c} = 5; return 1; }

You just have to dereference the hashref as an entire hash entity.


Dave

Replies are listed 'Best First'.
Re^2: Can I initialize/clear a hash reference?
by slloyd (Hermit) on Feb 25, 2005 at 05:10 UTC
    My thanks to both of you who replied.