"José nyimi" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The Perl slogan is: "There Is More Than One Way To Do It".
>
> I'm interested to see how you will do the small convertion below.

This sub grabs http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt
with LWP::Simple, extracts the current weather conditions out of the heading
and future forecast, Lowercases the entire string, uppercases the first word
in every sentence, and returns the string.

sub current_weather_conditions {
 my($weather) =
get('http://weather.noaa.gov/pub/data/forecasts/zone/oh/ohz021.txt');
 ($weather) or return('Today\'s weather conditions are currently
unavailable');
 $weather =~ s/.*?\n\.[^.]*?\.{3}(.*?)\n\..*/$1/s;
 $weather =~ tr/[A-Z]\n/[a-z] /;
 $weather =~ s/( ?)(.)(.*?)\./$1\U$2\E$3\./g;
 return($weather);
}

Todd W



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to