On Wednesday, September 3, 2003, 12:05:05 AM, Thomas wrote: >> #2 >> >> Is there a way to get matched data into variables without using >> matchdata, or perl ugly-variables? >> >> Again, in perl I could do something like: >> >> $_ = "Dec 12"; >> (mon, day) = /(\w+) (\d+)/; > this = "Dec 12" > that = $1 if this =~ /(\w+) (\d+)/ > other = $2 if this =~ /(\w+) (\d+)/ str = "Dec 12" regex = /(\w+) (\d+)/ mon, day = regex.match(str).captures _, mon, day = regex.match(str).to_a In one line: mon, day = /(\w+) (\d+)/.match("Dec 12").captures Gavin