>> just want to share with other unwary folk the pitfalls
>> of making an assumption about perl (or anything for that matter)
>>
>>
>
>You are definitely correct a hash reference is not a hash, its a reference
>:-). Specifically to a hash....
>
>>
>> i tried for the longest time to get something like
>> the following to work::
>>
>> foreach $section (keys %board){
>>
>
>First indication of ill effects is that you are looping over a list and
>setting your control variable, but then never using it. There are plenty of
>times when this will be needed but it appears in this case it may have hurt
>you not to....

in that case, i was using the foreach atatement to let me expand on my code
later.... at this point i didn't need it


>
>>         for my $a (1..19){
>>                 for (1..19){
>>                 $board->{"Q1S1"}->[$a]->[$_] and print "\n$a    $_";
>
>Is the first key above where you are needing your control variable or is it
>something completely different?

just an option to expand the code :)


>> if i got rid of the "foreach $section (keys %board){"
>> the rest would work fine.  I was about to yell at you guys about it
>> when, out of desperation, i tried one last thing :
>>
>> my $board = \%board; #first line in the whole thing
>>
>> and it WORKS!!!!
>>
>
>Good guess, but like you said you need to know why this works...
>
>>
>> It turns out that a reference to a hash that's created on the 'spur of
>> the moment' and not explicitly made to refer to a %HASH doesn't work
>> the same way as a real hash :P
>>
>
>huh? I think I am misunderstanding what you mean, a hash reference is a
>hash reference is a hash reference...

it was an error in my logic- i was using a hash reference as if it were a
hash (i do not always write as clearly as i should *laugh*)

if i start using $board as a hash reference without a %hash assigned to it-
then that foreach statement above .. " foreach $section (keys %board)"
wouldn't work -- i had to creat %board first!  it took me forever to get
that through my head!

>
>> now that i've figured this out, i would love to learn a bit about
>> /how/ this works.
>>
>
>Here are four very well priced places to start:
>
>perldoc perlreftut
>perldoc perlref
>perldoc perllol
>perldoc perldsc
>

i have not yet looked at these docs- but will shortly :)

>
>>
>> btw- i know it looks like nonsense code, but i cut out some
>> details in the cut and paste *shrug*  - just testing some functions on
>> an individual basis.....
>>
>>
>
>Good way to work, though for the purposes of this list it is often
>difficult to tell what you were doing/trying if the right amount of code is
>not presented. Though you seem to have grasped that concept well....
>

i've found that it's the only way for me to proceed effectively- even while
i try to document code for myself, if i leave a peice alone, i have to spend
time re-familiarizing myself with it- testing functions entirely separately
/keeps/ my code strongly compartmentalized and makes life so much easier.

--- learned /that/ the hard way too!

thank you so much by the way!

willy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to