Randy Kramer wrote:

> I've written a quick and dirty regular expression tester, but there's one 
> thing I'd like to try to clean up.
> 
> At the moment, to display all the groups, I have a series of print statements 
> like:

puts $~.captures

Avoiding the perlish variable:

if md = /foo(.+)bar(.+)qux/.match(str) then
   puts md.captures
end

or

puts Regexp.last_match.captures