From: Roman Zippel Date: 2001-04-21T19:27:46+09:00 Subject: [ruby-talk:13967] Re: regexp Hi, James Ponder wrote: > Quite often you have an input line, and you want to pull data out from it > using a regexp. In perl I would do the following, naming my fields without > ever using $1, $2, etc.: > > if (($key, $val) = $var =~ /^(.+)=(.+)$/) { > # ... > } You could try this: var.scan(/^(.+)=(.+)$/) do |key, val| ... end bye, Roman