In line 8 in the code below, I want to reset the string variable “content2” with the value in string variable “intro”. However, what I’m finding is that line 8 sets up “content2” as some type of pointer to “intro”: The content2.gsub commands I’m making in lines 9 through 12 are affecting the value
of “intro” as if I were doing “intro.gsub” commands.
The solution has got to be simple, but it it illudes me. Your help appreciated! Thanks! -k euler
In line 8 in the code below, I want to reset the string variable
“content2” with the value in string variable “intro”. However, what
I’m finding is that line 8 sets up “content2” as some type of
pointer to “intro”: The content2.gsub commands I’m making in lines
9 through 12 are affecting the value of “intro” as if I were doing
“intro.gsub” commands.
Well, sure. You’re just pointing to intro. If you want to edit it,
just make a copy of it.
The solution has got to be simple, but it it illudes me. Your help
appreciated! Thanks! -k euler
08 content2 = intro
try
content2 = intro.dup
···
On Tuesday 11 June 2002 02:09 pm, Kurt Euler wrote:
In line 8 in the code below, I want to reset the string variable “content2” with the value in string variable “intro”. However, what I’m finding is that line 8 sets up “content2” as some type of pointer to “intro”: The content2.gsub commands I’m making in lines 9 through 12 are affecting the value
of “intro” as if I were doing “intro.gsub” commands.
The solution has got to be simple, but it it illudes me. Your help appreciated! Thanks! -k euler
–
Dossy Shiobara mail: dossy@panoptic.com
Panoptic Computer Network web: http://www.panoptic.com/
“He realized the fastest way to change is to laugh at your own
folly – then you can let go and quickly move on.” (p. 70)
On Tuesday 11 June 2002 02:09 pm, Kurt Euler wrote:
In line 8 in the code below, I want to reset the string variable
“content2” with the value in string variable “intro”. However, what
I’m finding is that line 8 sets up “content2” as some type of
pointer to “intro”: The content2.gsub commands I’m making in lines
9 through 12 are affecting the value of “intro” as if I were doing
“intro.gsub” commands.
Well, sure. You’re just pointing to intro. If you want to edit it,
just make a copy of it.
The solution has got to be simple, but it it illudes me. Your help
appreciated! Thanks! -k euler
08 content2 = intro
try
content2 = intro.dup
–
Armin.
Armin Roehrl, http://www.approximity.com
Training, Development and Mentoring
OOP, XP, Java, Ruby, Smalltalk, Datamining, Parallel computing, Webservices
Koautor des ersten dt. Rubybuches http://approximity.com/rubybuch/
Naechstes Rubyseminar: 9/9-11/9 in Hamburg.