in reply to How do I replace all characters in a string with X's except the last 4 character

perl -e"$_='1234567890';print 'x' x length substr($_,0,-4), substr($_, +-4)"
or, in full-program form:

#!/usr/bin/perl -w use strict; $|++; my $string = '1234567890'; my $new_string = ( 'x' x length substr($string, 0, -4) ) . substr($str +ing, -4); print $new_string;

~Particle *accelerates*