Edward Wijaya wrote:
On Fri, 01 Oct 2004 07:41:43 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote:

Either put the scalar first in the list or pass a reference to the original hash.

Now, I also tried with pass by reference

my ($HoH,$limit) = @_;
foreach my $k ( keys %$HoH ) { # This two don't work
delete $HoH{ $k } if keys %${ $HoH{ $k } } < $limit;# What's wrong with my deref?

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;

return %$HoH;

But you don't really have to return the hash now as you are using a reference to the original hash which means that the original hash is modified by your subroutine.


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>




Reply via email to