Aliasing String#index:
   
    "rollo".index(/../, 1)
    puts "noalias #{$~}"
   
    class String
        alias old_index index
       
        def index(*arg)
            ret = old_index(*arg)
            puts "inside #{$~}"
            return ret
        end
    end
   
    "winni".index(/../, 3)
    puts "outside #{$~}"

gives

    noalias ol
    inside ni
   outside ol

To fully duplicate the functionality of the built-in String#index I need 
to transfer $~ from the local scope to the enclosing scope. Is there any 
way of doing this?

// Niklas