From: Logan Capaldo Date: 2006-08-14T03:43:43+09:00 Subject: Re: ruby equiv of perl pos On Aug 12, 2006, at 4:33 PM, snacktime wrote: > Or to be more exact, how would I do the following in ruby? > > while ($string =~ /\0/g) { > $new_string .= sprintf '\%o', (pos $string) - 1; > } > if perldoc -f pos is describing what pos does in this case, new_string = "" while pos = string =~ /\0/g new_string << "%o" % (pos - 1) end