Howdy: I know this is WAY out in left field, but I am trying to figure out how I can bring back a numerical value and evaluate it so I can do something else.
So, this is what I'm doing: I connect to the database, get a count of records and bring back that number. At least it looks good on paper ... but now I need to evaluate it as a number and not as a list item (if I'm making any kind of sense). [snip code] #!/usr/bin/perl -w use diagnostics; #created 24 May 02 # script to connect to database do a count # evaluate the count and decide to # build a table based on the count use DBI; use Net::SMTP; #$date=`date`; $mbr_count='/usr/local/home/joeuser/tmp/mbr_count.txt'; $addr='[EMAIL PROTECTED]'; my $dbh=DBI->connect('dbi:Pg:dbname=database', 'joeuser') or die "Can not connect: $!"; # create an sql to get the initial count # since i can not evaluate it and return the # true / false part (not sure how yet) # my $sql = qq| select count (*), from test_table | ; # check to make sure i have a connection # and if there is an error with the sql # my $sth=$dbh->prepare($sql) or die "Error =", DBI::errstr; unless ($sth->execute) { print"\n\tExecute failed for stmt:\n\t$sql\nError = ", DBI::errstr; $sth->finish; $dbh->disconnect; die "\n\t\tClean up finished\n"; } open COUNTFILE, ">$mbr_count"; print COUNTFILE "Count of member in test table\n\n"; print COUNTFILE "Please review\n\n"; ***PROBLEM AREA*** if ( ($memcount < 1500000 )=$sth->fetchrow) { print COUNTFILE "$memcount is all good ... next phase please\n"; } elsif { print COUNTFILE "$memcount is not good ... get to work\n"; } else { print "some other error: $!"; } close COUNTFILE; # maybe i should mail the results $sendmailcount = "/usr/sbin/sendmail $addr < $mbr_count"; print `$sendmailcount`; $dbh->disconnect; [/snip code] Yeah, I know I shouldn't be able to do the numerical eval on a list assignment, but how on earth CAN I do it? Thanks! -X