in reply to Re^4: FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at
in thread FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at

sub ab { $hash = { abc => 'cde', }; return "$hash is the value"; } $str = ab(); with $str how can i access the has of abc and its value. Since, its hash ref in a string..
  • Comment on Re^5: FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at

Replies are listed 'Best First'.
Re^6: FATAL ERROR: Can't use string ("HASH(0x875fffc)") as a HASH ref while "strict refs" in use at
by Corion (Patriarch) on Jun 20, 2008 at 08:02 UTC

    Basically, you can't. The memory allocated to $hash is released as soon as ab returns because there is no reference to $hash anymore. If you need a reference to data, keep it as a reference. Don't convert it to a string.