$x='justice,tan south jer,nor the pearl,her packer'; $_='ice'; foreach $y (split ',', $x) {$i=length; while($i) {$z=quotemeta;$y =~ s/([$z])//;$z =~ s/$1//;$_=$z; $i--;} $_=$y;s/ //g;print&&print ' ';}