On Sun, 2008-10-05 at 16:22 +0800, loody wrote: > Dear all: > I know there is a string replacement used by s///. > like: > $_=s/\.doc$/\.txt/; > #but above will change the content of $_ > > Here I have one question about how to replace some part of string A > without changing it and assign the changing result to string B? > like: > $_="test\.doc"; > and I want $stringB="test\.txt"; but $_ still keep as "test\.doc"; > > appreciate your help, > miloody >
( my $stringB = $_ ) =~ s/\.doc$/.txt/; -- Just my 0.00000002 million dollars worth, Shawn Linux is obsolete. -- Andrew Tanenbaum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/