Do you know where your variables are? | |
PerlMonks |
Re: Array equality woesby MarkM (Curate) |
on Oct 12, 2003 at 15:16 UTC ( [id://298658]=note: print w/replies, xml ) | Need Help?? |
The use of the 'eq' operator, or the '=~', will force the lvalue into scalar context. Your array, as a scalar, is interpretted to be the length of the array at the time of reference. You are comparing "1" to ".". You likely intend one of the following: @{$Circ->[$i][$j]} == 1 && $Circ->[$i][$j][0] eq '.'or, "@{$Circ->[$i][$j]}" eq '.'Note, in the latter case, that the array is being interpolated within a string. This code is equivalent to: join($,, @{$Circ->[$i][$j]}) eq '.'For simplicitly, I would choose to use a temporary variable:
Cheers,
In Section
Seekers of Perl Wisdom
|
|