From: Dave Thomas Date: 2000-01-28T10:50:51-06:00 Subject: [ruby-talk:01193] Semantics of chomp/chop I was wondering about the semantics of Kernel#chomp and Kernel#chop. Take 'chomp' static VALUE rb_f_chomp(argc, argv) int argc; VALUE *argv; { VALUE str = rb_str_dup(uscore_get()); if (!NIL_P(rb_str_chomp_bang(argc, argv, str))) { rb_lastline_set(str); } return str; } If no change is make to $_, a new copy of it is returned. If a change _is_ made, then it becomes the copy, which is returned. This additional rb_str_dup looks like it's trying to avoid some kind of aliasing problem. Is the extra copy necessary? Regards Dave