Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Think about Loose Coupling
 
PerlMonks  

Re^2: scraping temperatures

by molecules (Monk)
on Feb 10, 2010 at 22:17 UTC ( #822534=note: print w/ replies, xml ) Need Help??


in reply to Re: scraping temperatures
in thread scraping temperatures

How about the following? The variable $text should contain the text you want to check.

if( $text =~ m{ ( #open capturing parenthesis \d+ #numbers before the period \. #literal period \d+ #numbers after period ) #closing capturing parenthesis \s* #optional spaces ° #degree symbol F #literal letter F }xms){ my $temp = $1; # '$1' is what was found in capturing () if($temp > 75){ #code to send message } }else{ #code to deal with not finding temperature data. }
or without comments
if( $text =~ m{ (\d+ \. \d+) \s* ° F }xms){ my $temp = $1; if($temp > 75){ #code to send message } }else{ #code to deal with not finding temperature data. }
Note: Updated several times


Comment on Re^2: scraping temperatures
Select or Download Code
Re^3: scraping temperatures
by learn2earn (Acolyte) on Feb 11, 2010 at 14:05 UTC
    Thanks molecules! I found the error(s)I had its working now.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2014-04-19 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (473 votes), past polls