From: Austin Ziegler Date: 2006-11-03T06:16:18+09:00 Subject: Re: str1 = str2 is not a copy?!? On 11/2/06, Joe Ruby MUDCRAP-CE wrote: > WHY is var line getting changed by operations on var base_name? Isn't > 'base_name = line' supposed to create a copy? '=' in this case seems > to be acting like an alias or something. No, it isn't. You're not understanding Ruby variables and assignment. Variables in Ruby aren't locations; they're names. Objects are the only things that take up (meaningful) space. Assignment doesn't copy. > BTW, is there a foreach function that automatically strips off the > newlines from line? Returning the record separators is silly. No, it isn't silly. Sometimes, that's what people want. You should be using #chomp or #chomp! to strip that (use #strip or #strip! if and only if you want to remove whitespace from beginning and end of the line). -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca