Hi,
I am having a problem figuring out how to multiply two numbers I get from a query and then dividing it by another number and subtracting one.
Let me show you what it would look like. It would look something like this ((data1*data2)/data3)-1). Is it possible to do this type of thing?
I've tried breaking it up by doing this
my $question = (data1*data2);
my $question2 = (($question/data3)-1);
And that doesn't seem to work. I keep getting the error on the line with the multiplication sign. Could it be that * is used for something else in perl?
I would be greatful.for any help
Thanks
here's my code
sub main { my $oCGI = CGI->new(); my $oSearch = XDrive::DatabaseO::Search->new(undef); my $oDBO = XDrive::DatabaseO->new(); my $dbh = $oDBO->fetchDBH(); my (sql, results,avg_additional,$new_user,avg_repeat_logins ) +; ########################### # # Queries # ########################### $sql = "SELECT count(login_num) FROM disk_account WHERE login_num >= 1 AND last_login >= sysdate - 30 AND created_on >= sysdate - 30"; $result = $oSearch->XDSQLSearch($sql); my $life_one = $result->[0]->[0]; $sql = "SELECT count(*) FROM disk_account WHERE last_login >= SYSDATE - 30 AND created_on >= sysdate - 30"; $result = $oSearch->XDSQLSearch($sql); my $life_two = $result->[0]->[0]; $new_users = ($life_one/$life_two); $sql = "SELECT avg(login_num) FROM disk_account WHERE last_login >= sysdate - 30 AND created_on >= sysdate - 30"; $result = $oSearch->XDSQLSearch($sql); $avg_repeat_logins = $result->[0]->[0]; $avg_additional = (($avg_repeat_logins*life_two)/life_one)-1); $oSearch->disconnect(); $dbh->disconnect(); $oDBO->disconnect(); $oSearch->disconnect(); }
In reply to Need help in doing multiplication by fgcr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |