It sounds like you're trying to make life too hard for yourself. Try something like the following. It will need be adjusted slightly depending on the exact composition of whitespace etc.
my $data = '8 changes by 4 users: user1 user2 user3 user4';
my @users;
if ($data =~ /^1 change by (\S+)$/) {
@users = $1;
}
elsif ($data =~ /^\d+ changes by (\d+) users: (.*)$/) {
my ($n, $users) = ($1, $2);
@users = split ' ', $users;
die "user count mismatch\n" unless @users == $n;
}
else {
die "unrecognised format: $data\n";
}
print "[$_]\n" for @users;
Dave.