[luau] Perl Frustration!!

Matt Darnell mdarnell at servpac.com
Sun Aug 17 13:51:00 PDT 2003


> Aloha,
>
> I am writing the following routine:
>
> while (my $row_ref6 = $sth6 ->fetchrow_arrayref){
>      if (@{$row_ref6} == '1') {
>           print "Status is @{$row_ref6}\n";
>      }
> }
>
>
> The database access works fine.  It produces the following output
>
> Status is 0
> Status is 1
> Status is 0
>
> I only want to know when the value is 1.  I have a feeling it evaluates to
> true simply because it exists.
>
> When I try to convert it to a scalar it changes the 0's to a 1.
>
> I have subsituted 'eq' for '==' to no avail.

I don't know if it possible to get where I was going from the above code,
but this code:

while (my @result = $sth6 ->fetchrow_array){
     if (@result[0] == "1") {
          print "Status is @result\n";
     }
}

Acheives the correct result.  Maybe it was returning the amount of items in
the hash?

-Matt




More information about the LUAU mailing list