#!/usr/bin/perl @weather = `wget -O - "http://printer.wunderground.com//US/CA/San_Diego.html"`; foreach $line (@weather) { if (grep /Updated:/, $line) { $updated = $line; $updated =~ s/\sUpdated:\s//g; $updated =~ s/on\s//g; $updated =~ s/<\/b>
Observed at//g; $updated =~ s/ PM P[D-S]T/PM/g; $updated =~ s/ AM P[D-S]T/AM/g; $updated =~ s/, \d\d\d\d//g; chomp($updated); } if ((! $once) && (grep /\d\d+<\/b> °F/, $line)) { $once = 1; $temp = $line; $temp =~ s/#\d\d\d//g; $temp =~ s/\D+//g; #$temp =~ s/176F//g; chomp($temp); } if ($conditions eq 1) { $conditions=$line; $conditions =~ s/<\/[a-z]+>//g; $conditions =~ s/<[a-z]+>//g; chomp ($conditions); } if (grep /Conditions<\/td>/, $line) { $conditions=1; } } print "Temp:",$temp, "F "; print "$conditions - "; print "$updated\n";