Hi,

Am Samstag, 27. Jun 2009, 05:55:20 +0900 schrieb Peter Wu:
> s = "1234" [0..1]
> s = s[1]
> p s      #> 50
> 
> I can see the reason for this happening, but I don't want it to happen.

The answer has already been given.

As far as I know Ruby 1.9 returns "2".

There's another [] operator that's not well known:

  16[4]  #=> 1    (the 4th bit is 1)

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de