On Fri, Dec 16, 2005 at 05:05:00AM +0900, Ryan Leavengood wrote: > Just to add another voice to the maelstrom: I have never coded Perl > and don't particular like it, but I almost always use the $1 variables > in Ruby. I have been coding Ruby for over four years and I rarely find > instances where MatchData is all that much better than =~ and the $1 > variables. > > They are just more convenient in the typical case: MatchData can be quite convenient too str = "foobar 2005-12-15" if md = /(\S+) (\d+)-(\d+)-(\d+)/.match(str) name, year, month, day = md.captures # => ["foobar", "2005", "12", "15"] name # => "foobar" # .... end If you want to name the captures, md.captures looks better than $1, $2, $3, $4 -- Mauricio Fernandez