in reply to Globals printing HASH

HASH(0x68e26a8) is a reference to a hash. You could be printing a raw object, maybe a class used to overload " but no longer does?

Replies are listed 'Best First'.
Re^2: Globals printing HASH
by pglinx (Acolyte) on Feb 24, 2010 at 15:47 UTC
    It seems when I use my ($foo) = { }; to declare some globals it happened if I used my ($foo) = ""; to declare it it fixed the problem. Is there any issues using that way if it works?
      Is there any issues using that way if it works?
      my $foo = {}; # $foo a reference to an empty anonymous hash my $foo = ""; # $foo contains an empty string my $foo; # $foo is undef
      If you are going to use the variable as a reference to a hash then by all means initialise it that way, if you are going to store text there then initialise it as an empty string, if storing numbers then initialise it to zero. If not sure, then leave it undef.

      If you want  $foo to hold an empty string rather than a reference to an anonymous hash, then no, no issue at all.