Edward Wijaya wrote:
On Fri, 01 Oct 2004 08:58:44 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote:
Since $HoH now contains a reference to a hash you have to dereference
it properly.
delete $HoH->{ $k } if keys %${ $HoH->{ $k } } < $limit;
return %$HoH;
I apologize for insisting John.
Tried as you suggested:
64: sub reduce_hash2 {
65: my ($HoH,$limit) = @_;
66: foreach my $k ( keys %${HoH} ) {
67: delete $HoH->{ $k } if keys %${ $HoH->{ $k } } < $limit;
68: }
69: return %$HoH;
70: }
with this command:
my %new_hoh = reduce_hash2(\%hoh,2);
Gives error:
Not a SCALAR reference at testcode.pl line 67.
Sorry, there is an extra $ in there, it should be:
67: delete $HoH->{ $k } if keys %{ $HoH->{ $k } } < $limit;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>