in reply to RegExp help

You're right; $2 is getting clobbered when your second regex succeeds. You need to save it away in another variable someplace before you do your next regex. A simple test:
my $string = "one two three four five"; my $tmp = "this doesn't matter"; $string =~ /(\S+) (\S+) (\S+) (\S+) (\S+)/; # $1 through $5 are set print "\$3=$3\n"; $tmp =~ s/\S*$//; # random regex print "\$3=$3\n";
The output (with warnings):
$3=three Use of uninitialized value in concatenation (.) or string at test line + 10. $3=