From: windwiny Date: 2013-04-19T17:57:52+09:00 Subject: Re: "gets" overwrites string - why does this happen? --047d7b6dc3d4e8410804dab2e941 Content-Type: text/plain; charset=UTF-8 using filename = $*.dup because a = [] b = a a.__id__ == b.__id__ 2013/4/19 Philip Rhoades > People, > > If I run this script with a text filename parameter: > > #!/usr/bin/ruby > > puts $* > filename = $* > puts filename > gets > puts $_ > puts filename > > - the last puts is empty! Why does this happen? > > Thanks, > > Phil. > -- > Philip Rhoades > > GPO Box 3411 > Sydney NSW 2001 > Australia > E-mail: phil@pricom.com.au > > --047d7b6dc3d4e8410804dab2e941 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
using
=C2=A0 =C2=A0filename =3D $*.dup

=
because=C2=A0
=C2=A0 =C2=A0a =3D []
=C2=A0 =C2=A0b =3D a<= /font>
=C2=A0 =C2=A0a.__id__ =3D=3D b.__id__


2013/4/= 19 Philip Rhoades <phil@pricom.com.au>
People,

If I run this script with a text filename parameter:

#!/usr/bin/ruby

puts $*
filename =3D $*
puts filename
gets
puts $_
puts filename

- the last puts is empty! =C2=A0Why does this happen?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW =C2=A0 =C2=A0 =C2=A02001
Australia
E-mail: =C2=A0phil@= pricom.com.au


--047d7b6dc3d4e8410804dab2e941--