in reply to Re: Search for abcNUMBERdef, make it a variable, then do math?
in thread Search for abcNUMBERdef, make it a variable, then do math?

I'll try that out and post back. I'm just trying to change Today: today408today Yesterday: yesterday555yesterday This Month: this11360this Last Month: last5350last in to Today: 1.63 Yesterday: 22.22 This Month: 45.44 Last Month: 21.40 40% of what the number is, with the period added. By doing this math for each of them. For example... Today: today408today would do 408*.4/100=1.63200 with the '200' part taken off.

Replies are listed 'Best First'.
Re^3: Search for abcNUMBERdef, make it a variable, then do math?
by Jesse Smith (Acolyte) on Jan 22, 2011 at 09:26 UTC
    SSH spits out
    root@wor [/home/site82/public_html/cgi-bin]# perl stats.cgi Prototype mismatch: sub main::head: none vs ($) at stats.cgi line 19 today: 0 (from ) last: 0 (from ) this: 0 (from ) yesterday: 0 (from )
    The first part of the script is
    if (length ($ENV{'QUERY_STRING'}) > 0){ $buffer = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $buffer); foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg +; $in{$name} = $value; } } my $id = param('id'); use LWP::Simple; $id2 = get ("http://www.domain.com/stats.php?id=$id");
    and Line 19 is use LWP::Simple;
      Prototype mismatch: sub main::head: none vs ($) at stats.cgi line 19

      See CAVEAT in the LWP::Simple docs:

      Note that if you are using both LWP::Simple and the very popular CGI.pm module, you may be importing a head function from each module, producing a warning like "Prototype mismatch: sub main::head ($) vs none". Get around this problem by just not importing LWP::Simple's head function, like so:

      use LWP::Simple qw(!head); use CGI qw(:standard); # then only CGI.pm defines a head()

      As for "The first part of the script is" part:  why are you parsing the QUERY_STRING yourself, when you're using CGI.pm anyway — as the warning and your line my $id = param('id') indicates?  CGI.pm does the parsing already, so you can just drop that code...