I have a problem, i can successfully fetch one team name from a URL, but how do I fetch multiple team names after a certain word? I currently am extracting the team name after the word baseball, so every time 'baseball' occurs (20 or 30 times in the URL source) i want to extract each different team name into a seperate variable. TIA! CODE BELOW. PERL
if ($sportname eq 'MLB') {
my $source=get("the URL has been deleted for security");
$_ = $source;
my $count = 1;
while (/baseball\/...\"\>/gism){
my @words;
@words = split(/\s+/gism, "$'\\");
if (++$count == 5) {
my $teamname = @words[0] . " " . @words[1];
print $teamname;
}
}
}