psykx.out wrote:
> Hey I'm getting this error
>
> Useless use of hash element in void context at ./three.pl line 97.
>
> I have googled it and found that I am probably treating a scalar like a 
> hash reference but I can't see where. below is the offending lines
>
> 90    if( defined $thash{$k[$key]} ){
> 91    $n = $result;
> 92    while( !defined $high ){
> 93            $n++;
> 94        if ( ${$thash}{$k[$key]}{$j} => $result ){
> 95                $high = ${$thash}{$k[$key]}{$j};
> 96            }
> 97    }
>
>   

94        if ( ${$thash}{$k[$key]}{$j} => $result ){

Are you intending to do a hash assignment? I'm guessing you men >= or ==.

A bit of arrow notation and spacing wouldn't go a miss :-P


> Yes those are the correct line numbers I think I just have sooo many 
> errors. $thash is a reference to a multidimensional hash (2D), $key is 
> an int and $k is an array reference.
>   

if $thash is a reference, then shouldn't you have:-

90    if( defined $thash->{ $k->[$key] } ){

I'm not sure what $j is, I'm guessing another hash key? Maybe:-

91    $n = $result;
92    while( !defined $high ) {
93            $n++;
94        if ( $thash->{ $k->[$key] }->{$j} == $result ){
95                $high = $thash->{ $k->[$key] }->{$j};
96            }
97    }


When nested data structure start to get confusing Data::Dumper is a real 
life saver:-

use Data::Dumper;
print  Data::Dumper->Dump([$thash],[qw (thash)]);


Lyle

_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to