From: dblack@... Date: 2006-11-03T06:48:16+09:00 Subject: Re: str1 = str2 is not a copy?!? Hi -- On Fri, 3 Nov 2006, Paul Lutus wrote: > Joe Ruby MUDCRAP-CE wrote: > > / ... > >> WHY is var line getting changed by operations on var base_name? > > Because in most cases, variable names contain references for the sake of > efficiency. To get the behavior you want, try: > > base_name = "" + line You don't have to resort to a workaround like that; you can do: base_name = line.dup David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org