Jos Backus wrote: > Given Perl's > > $_ = "123 foo"; > > s/^(\d+)\s+//; > $pid = $1; > > print "$_\n$pid\n"; > > all I can come up with is > > line = "123 foo" > > pid = nil > line.sub!(/^(\d+)\s+/) {pid = $1; ''} > > puts line, pid Closer to the original Perl: line = "123 foo" line.sub!(/^(\d+)\s+/, '') pid = $1 puts line, pid The Pickaxe doc for String#sub states the MatchData $-variables will be available using the block form of String#sub!, but it doesn't bother to remind you that they are available in the non-block form as well. -- Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>