Moving on, same subject/problem, but slightly different scenario.. In my next variable $variable2, i have entries:
$variable2 = "#ha #bad #cod #ba #dog"; Basically, i want to be able to remove #ba, without removing #ba from #bad, so it ends up: $variable2 = "#ha #bad #cod #dog"; This also needs to be acheived without looping. I tried the method given for the first scenario of $variable, but for some reason that solution doesn't seem to be working for this. Help much appreciated. Dan "John W. Krahn" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Dan wrote: > > > > Hey, I have a slight dilemma which i'm struggling to overcome. Wondering if > > anyone has any ideas on this.. > > > > I have a variable, for example's sake, say $variable. $variable has a load > > of entries. > > > > $variable = "danneh blah dan etc danster"; > > > > What i want to do, without having to set the entire string to an array, loop > > through it, compare etc, is to remove the single entry "dan", and leave the > > other 2 entries with "dan" contained in them in tact. I used to use > > > > $remove = "dan"; > > $variable =~ s/\Q$remove//g; > > You need to use the \b word boundary zero-width assertion. > > $variable =~ s/\b\Q$remove\E\b//g; > > > > John > -- > use Perl; > program > fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]