my $line = 'She was very absorbed in her homework.'; my $word = 'absorb'; $_=$line; s/ ($word)//g; print "\$1 is $1\n"; $_=$line; s/ ($word)//i; print "\$1 is $1\n"; $_=$line; s/ ($word)//ig; print "\$1 is $1\n"; #### #This also fails s/(\b$word)//ig; #Although this is ok s/( $word)//ig; #And this is fine, too! my $pat = qr/\b($word)/; s/$pat//gi; #or even my $pat = qr/($word)/; s/\b$pat//gi; #or EVEN THIS! my $pat = qr/$word/; s/\b($word)//gi;