On Sunday, May 12, 2002, at 11:08 PM, Todd Wade wrote:
> > "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 > this one wins the prolix award of the solutions we have seen today. we dare a non-perl programmer to believe this could mean something. I'm not sure i believe it means whatever. especially (?)(.) - zero or one character followed by a character? followed by a non-greedy run of characters up to dot? something to lose sleep over, i think. and this is the beginner's list. geez. and that was only one line out of three. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]