in reply to Some more regex

Capture parens will only return one value per application of the regex. Your try has three sets, so it will return three values, no matter how many times that *? repeats. To do what you want, you need the //g flag:
$x="[x=1 y=3 z=5]"; print join ":", $x=~/(\w+)=(\d+)/g;
That just skips over the [, ], and spaces around your = pairs.

The above will treat foo-bar=5 as bar=5, ignoring the "foo-" since it has a non-\w char. To know that your regex is parsing the complete string successfully, do it like this:

print join ":", $x=~/\G # start where prev match left off (?:\A\[)? # if start of string, expect [ (\w+)=(\d+) # our data (?:\s(?!\z) # between pairs, expect \s |\]\z) # or if end of string, expect ] /gcx; # if whole string was parsed, pos will be defined and equal to length print "error" unless pos($x) && pos($x) == length($x);
This is a very useful idiom (to me anyway). It looks fairly complicated at first, but once you go through and understand it, you can see that most of it stays the same for different applications. You just replace the first \[, the data line, the \s, and the last \[ as appropriate for what you are parsing.