Hi,

On Wed, 02 Jun 2004 08:47:30 +0200, Robert Klemme wrote:
> def myformat(str, hash)
>   str.gsub( %r{%\((\w+)\)} ) {hash[$1]}
> end
> 
>>> myformat("My name is %(name)s and my age is %(age)d.", "name" => "Sam",
> "age" => 34)
> => "My name is Sams and my age is 34d."

I don't think that's the output he wanted.  He wanted
to have de value of %(name)s converted to a string,
and %(age)d to a number  (see my other post for an
implementation).

Kristof