#!/usr/bin/perl use warnings; use strict; my $str = "abc xxxssyy zx"; $str =~ s/(.)/($1 eq 'b' | $1 eq 'z' | $1 eq 'y')? "" : $1/egs; print $str;