in reply to Re: scraping temperatures
in thread scraping temperatures
or without commentsif( $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. }
Note: Updated several timesif( $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. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: scraping temperatures
by learn2earn (Acolyte) on Feb 11, 2010 at 14:05 UTC | |
by smile4me (Beadle) on Feb 11, 2010 at 15:47 UTC |