On Thu, 28 Jun 2001, F.H wrote:
> I just wonder why the if condition is always true regardless of the value of the
>array AB.
> @AB = [1,2], and $i gets printed even for values not inlcuded in array AB.
>
> foreach $i ( 0 .. $#{ $testsec{'AB'} } ) {
> if ($testsec{'AB'}[$i] = "6543"){ # always true!!!!
Because you are assigning a value here to the array element in the hash,
and the assignment is always successful. What you want is either == if
you are checking for equality to a number, and eq if you are checking for
equality to a string.
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
A budget is just a method of worrying before you spend money, as well
as afterward.