That code is legal Ruby! If you ran it, you’d see 8. How? There’s a tale to tell..
The String with the Golden Space
I was on IRC in #nwrug enjoying festive cheer with fellow Northern Rubyists when ysr23 presented a curious problem.
He was using a Twitter library that returned a tweet, “@twellyme film”, in a string called reply. The problem was that despite calling reply.split, the string refused to split on whitespace. Yet if he did “@twellyme film”.split in IRB, that was fine.
International man of mystery Will Jessop suggested checking $; (it’s a special global variable that defines the default separator for String#split). Read More
Read more at the source