From: yermej Date: 2007-11-16T07:00:06+09:00 Subject: Re: Using a variable with gsub & sub On Nov 15, 3:34 pm, Peter Vanderhaden wrote: > In the following statement, I'm replacing ,, with ,NULL,. > > $inrec = $inrec.sub(',,\\',',NULL,') > > What I want to do is something like this: > > $inrec = $inrec.sub(',,\\',',$variable,') > > Unfortunately, I haven't been able to figure out the syntax for using a > variable with sub & gsub. Can someone help me out? $inrec.gsub! ',,\\', ",#{$variable}," Though I'm not sure why you have the \\ in there, unless it just didn't end up on the newsgroup correctly.