Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Perl Question


Can anyone with greater knowledge than myself explain this regex
behaviour.
This code segment works as intended:


if ( $_ =~ m/^Box(\d) ([A-Z]+(\. | ?)[A-Z]* ?[A-Z]*).*?(\d).*?(\d\d\.\d
\d).*?(\d*\.\d\d)L/) {
		$box = $1;
		$name = $2;
		$place = $4;
		$time = $5;
		$margin = $6;
		$name =~ s/\.//;
			}

However if the $name substitution is inserted above $place like so it
fails to allocate values to $place, $time and $margin.


if ( $_ =~ m/^Box(\d) ([A-Z]+(\. | ?)[A-Z]* ?[A-Z]*).*?(\d).*?(\d\d\.\d
\d).*?(\d*\.\d\d)L/) {
		$box = $1;
		$name = $2;
		$name =~ s/\.//;
		$place = $4;
		$time = $5;
		$margin = $6;
			}
Undoubtedly something simple that a self taught dummy has failed to
grasp.

Regards,
Peter.

Happy & proud to be,
100% Microsoft free.