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]

Reply via email to