When comparing strings in perl you usually use the eq operator, not ==

e.g.  if($cust_data->{hold} eq 't')

- Andrew



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of Randall Perry
> Sent: Monday, 3 September 2001 10:01 AM
> To: [EMAIL PROTECTED]
> Subject: [GENERAL] Perl won't eval PgSQL boolean value
> 
> 
> I've got an if statement that checks if a boolean value is true:
> 
>     if ($cust_data->{'hold'} eq 't')
> 
> But perl will not evaluate the value. $cust_data->{'hold'} is 
> taken from a PgSQL boolean field (either t or f). If I use 
> the construct above it tell me that 'eq' is not defined 
> thinking it's a string.
> 
> If I use:
> if ($cust_data->{'hold'} == 't')
> 
> I get an error saying $cust_data->{'hold'} is a non-numeric value.
> 
> If I do this:
>  if ($cust_data->{'hold'})
> 
> it will always evaluate to true whether the value is 't' or 'f'.
> 
> 
> HELP. How do you evaluate boolean values from PgSQL in Perl?
> 
> 
> -- 
> Randy Perry
> sysTame
> Mac Consulting/Sales
> 
> phn                 561.589.6449
> mobile email        [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to