[luau] Perl Frustration!!
Vince Hoang
luau at ml.altern8.net
Mon Aug 18 11:24:00 PDT 2003
On Sun, Aug 17, 2003 at 01:55:03PM -1000, Matt Darnell wrote:
> > if (@{$row_ref6} == '1') {
I think you actually wanted:
if ($row_ref6->[0] == 1)
> if (@result[0] == "1") {
> print "Status is @result\n";
> }
> }
>
> Acheives the correct result. Maybe it was returning the amount of items in
> the hash?
Yes. In the first condition, you are counting the number of
elements in the array and not the value of the first element. You
actually want to compare numeric scalars to scalars like:
if ($result[0] == 1)
The second comparison worked because perl knows you want to
compare scalars, even though you are actually comparing an array
(@result) to a scalar string.
-Vince
More information about the LUAU
mailing list