your mail

Bob Kleemann rkleeman at energoncube.net
Wed Apr 23 16:22:24 CDT 2003


~sdpm~
Well, first of all I'd change your code just slightly, get rid of the
quotes around $sql on line 5:

> 5	@ret = $dbh->sql($sql, sub {($date_diff)=@_;});

It doesn't hurt anything, it's just doesn't need to be there.

Also, what would be printed if you put this between line 5 and 6:

print STDERR "date_diff == $date_diff, diff_test == $diff_test\n";

On Wed, Apr 23, 2003 at 12:22:16PM -0700, Bill Wood wrote:
> ~sdpm~
> Can someone help me out. I've got a problem where perl seems to be 
> evaluating the test at line 6 below in a string context. I'm taking the 
> results of database call to a datediff function and doing a greater than 
> test. When the result is negative the if branch is still being taken. I 
> can't see what is wrong here.
> 
> 
> 1	my $date_diff=0;
> 2	my $diff_test = 0;
> 3	my $sql = qq/
> 4	select datediff(dd,"$last_used_date{$card_key}","$trans_date")/;
> 	
> 5	@ret = $dbh->sql("$sql",sub {($date_diff)=@_;});
> 
> 6	if	($date_diff > $diff_test ) {
> 7		$last_used_date{$card_key} = $trans_date;
> 8		}
> 
> This is perl, version 5.005_03 built for sun4-solaris
> 
> All comments appreciated, thanks
> 
> Bill Wood
> University of California at San Diego
> Administrative Computing and Telecommunications - 0929
> 10280 North Torrey Pines Rd.
> La Jolla, Ca   92093-0929
> 
> EMail:	wwood at ucsd.edu
> Phone:	858/534-1291
> Fax:	858/534-7656
> 
> ~sdpm~
> 
> The posting address is: san-diego-pm-list at hfb.pm.org
> 
> List requests should be sent to: majordomo at hfb.pm.org
> 
> If you ever want to remove yourself from this mailing list,
> you can send mail to <majordomo at happyfunball.pm.org> with the following
> command in the body of your email message:
> 
>    unsubscribe san-diego-pm-list
> 
> If you ever need to get in contact with the owner of the list,
> (if you have trouble unsubscribing, or have questions about the
> list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
> This is the general rule for most mailing lists when you need
> to contact a human.
~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list