I'm testing a regex with the sample data

Chicago Bulls 55 66
Miami Heat 13 44
Alpha Dogs 22 48
Hornets 84 22
Celtics 22 24

while($line = <FH>)
{
   $line =~ m/((\w+\s+)?\w+)\s+(\d+)\s+(\d+)/;
   ($team,$wins,$losses) = ($1, $3, $4);
   print $team;
}

I came up with the following regex to map team names, wins and losses into 3
varibles
I'm having a hard time understanding how regex capture matches work ie.
which exactly group is grabbing $1

Thanks in advance.

--
Rodrick R. Brown
http://www.rodrickbrown.com

Reply via email to