RE: simple substitution question

2005-02-18 Thread Manav Mathur
=~ is the bind operator. see perldoc perlop. Manav -Original Message- From: Harold Castro [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 12:17 PM To: beginners@perl.org Subject: simple substitution question Hi, There is something that's bothering me for so long regarding

Re: simple substitution question

2005-02-18 Thread Ing. Branislav Gerzo
Harold Castro [HC], on Thursday, February 17, 2005 at 22:47 (-0800 (PST)) typed: HC> for example: HC> here is my string: HC> $_ = "but"; HC> s/u/a/g; HC> print $_; what about this: ( my $string = "but" ) =~ s/u/a/g; -- ...m8s, cu l8r, Brano. [Old Farts don't have to be politically correct.]

RE: simple substitution question

2005-02-17 Thread Bedanta Bordoloi, Gurgaon
Hi, If I've understood your problem, what you can simply try is $string = "but"; print "Before: $string "; $string =~ s/u/a/g; print "After: $string\n"; You will get as output $ Before: but After: bat Cheers, Bedanta -Original Message- From: Harold Castro [mailto:[EMAIL PROTECTED]

Re: Simple Substitution

2002-06-12 Thread Michael Norris
Ok, I'm trying to understand this. >open(CONFIG, "< /home/mnorris/$first_file") || die "Sorry, I couldn't READ >/home/mnorris/$first_file\n"; > while () { > s//$first_var/; > push @newdata, $_; > } >close(CONFIG); this pushes the replaced values into @newdata? How is this keeping

Re: Simple Substitution

2002-06-12 Thread David vd Geer Inhuur tbv IPlib
Nope, open(CONFIG, "< /home/mnorris/$first_file") || die "Sorry, I couldn't READ /home/mnorris/$first_file\n"; while () { s//$first_var/; push @newdata, $_; } close(CONFIG); open(NEWCFG, "> /home/mnorris/$first_file") || die "Sorry, I couldn't WRITE to /home/mnorris/$first_f

RE: Simple Substitution

2002-06-12 Thread Bob Showalter
> -Original Message- > From: Michael Norris [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 12, 2002 10:24 AM > To: [EMAIL PROTECTED] > Subject: Simple Substitution > > > This should work, shouldn't it? > > open(CONFIG,">>/home/mnorris/$first_file") || die "Sorry, I > couldn't creat