in reply to First Attempt

Just a slight modification using the $& variable =D
$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/$&//;$_=$z; $i--;} $_=$y;s/ //g;print&&print $&;}

janitored by ybiC: Retitle from one-word "Update" to avoid hindering site search