Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by Corion (Pope)
on Jan 22, 2011 at 19:49 UTC ( #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.


Comment on Re^3: Search for abcNUMBERdef, make it a variable, then do math?
Select or Download Code
Re^4: Search for abcNUMBERdef, make it a variable, then do math?
by Jesse Smith (Novice) 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
Node Status?
node history
Node Type: note [id://883713]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-11-26 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls