in reply to class object and hash

Since your hash values are scalars, you want to store a reference to the hash:
sub compileserverhash { my %hash; # .... return \%hash; }

-Mark

Replies are listed 'Best First'.
Re^2: class object and hash
by bengmau (Beadle) on Oct 19, 2004 at 20:20 UTC
    I've modified my return code to do the above however when I make the call to:
    my %hashlist = $self->{SERVERLOCATION}
    The contents of %hashlist are a scalar with with value: HASH(ox2023244) am I supposed to assign it in a different way such as: my %hashlist = %{$self->{SERVERLOCATION}}
      arghh.. my goof!!
      %{$self->{SERVERHASHLIST}}=compileserverhash(); %{$self->{SERVERLOCATION}}=compileserverloc();
      Guess I was running low on coffee did the above before posting. as soon as I removed the %{}'s it came in fine with the referencing on the calling subroutine.
      $self->{SERVERHASHLIST}=compileserverhash(); $self->{SERVERLOCATION}=compileserverloc();
      Thanks all