Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Search for abcNUMBERdef, make it a variable, then do math?

by Corion (Patriarch)
on Jan 22, 2011 at 19:49 UTC ( [id://883713]=note: print w/replies, xml ) Need Help??


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

I would assume that Perl is right when it points you to line 9.

... foreach my($pair) (@pairs){ ...

This is not valid Perl code. The valid Perl code would be (note the lack of parentheses)

foreach my $pair (@pairs){

But in all seriousness, why are you trying to do what is CGI.pm's job? Just use CGI; and then query $q->Vars to get a hash of parameters passed to your script. Don't parse query strings yourself.

Replies are listed 'Best First'.
Re^4: Search for abcNUMBERdef, make it a variable, then do math?
by Jesse Smith (Acolyte) on Jan 22, 2011 at 20:13 UTC
    #!/usr/bin/perl use warnings; use strict; use LWP::Simple qw(!head); use CGI qw(:standard); # then only CGI.pm defines a head() my($id) = param('id'); my($id2) = get ("http://www.domain.com/stats.php?id=$id"); $id2 =~ s*\[Yesterday\] *Yesterday: *g; **LOTS more search and replaces go right here** while(<DATA>) { if(/([\w\s]+:)\s([a-z]+)(\d+)\2/) { print "$1 ", sprintf("%5.2f\n",$3*0.4/100); } } Name "main::DATA" used only once: possible typo at stats.cgi line 15. Use of uninitialized value in concatenation (.) or string at stats.cgi + line 11. (Line geting the URL) readline() on unopened filehandle DATA at stats.cgi line 15.

      What are you trying to tell me with this reply?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://883713]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-16 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found