package X; sub new { my ($class) = @_; my %ht = (); %ht= ("x" => "y"); my $self = { HREF => \%ht, }; bless $self, $class; return $self; } sub PrintHash { my($self) = @_; # this doesn't work ("scalar found where operator expected"): # while( my ($k, $v) = each (%$self->{HREF}) ) # . . . } 1;
use X; my $x = new X(); $x->PrintHash();
In reply to hash ref as member of class by bob_dobalina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |