in reply to Re: can't use string as hash ref
in thread can't use string as hash ref

# this will be ok $hash{1}{\@array}{1} = 42; #this will be ok $hash{1}{\@array}{1}{1} = 42;
The latter doesn't work either (it just doesn't issue an error here, 'cos the script is dying after the first problem on line 13).

The reason is simply that if you assign 42 to $hash{\@array}, or $hash{1}{\@array}{1} for that matter, and then try to deference that value in the next statement, you're essentially trying to say

"42"->{1} = 42
which obviously doesn't make sense.

Replies are listed 'Best First'.
Re^3: can't use string as hash ref
by spickles (Scribe) on Oct 25, 2010 at 15:46 UTC

    Thanks for all of the replies. It sounds like I have a dereferencing issue. I'm going to take another whack at it and post back. Each time I use hashes and think I've got it 'licked' ....