<html> <body>

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

</body> </html>
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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.