Forum Moderators: open

Message Too Old, No Replies

perl web fetch and array problem

figured id post here for lack of a better place...

         

pkmcbster

9:34 am on Apr 11, 2006 (gmt 0)

10+ Year Member



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;

}
}
}

pkmcbster

9:46 am on Apr 11, 2006 (gmt 0)

10+ Year Member



nevermind ;)