my ($location) = $html =~ m/Location:\s*([^<]+)/i;
my ($time) = $html =~ m/Time:\s*([^<]+)/i;
my ($days) = $html =~ m/Days:\s*([^<]+)/i;
my ($instructor) = $html =~ m/Instructor:\s*([^<]+)/i;
# if you want plain text you will need to do this
$location = unescapeHTML($location);
$time = unescapeHTML($time);
$day = unescapeHTML($days);
$instructor = unescapeHTML($instructor);
# this unescapes common cases, not all possible cases. For perfection -> CPAN
sub unescapeHTML {
my( $unescape ) = @_;
return undef unless defined($unescape);
$unescape=~ s[&(.*?);]{
local $_ = $1;
/^amp$/i ? '&' :
/^quot$/i ? '"' :
/^gt$/i ? '>' :
/^lt$/i ? '<' :
/^nbsp/i ? ' ' :
/^#(\d+)$/ ? chr($1) :
/^#x([0-9a-f]+)$/i ? chr(hex($1)) :
$_
}gex;
return $unescape;
}
####
my @location = $html =~ m/Location:\s*([^<]+)/gi;
# first match will be in $loction[0] and last match (no suprisingly) in $location[-1]