my $string = '5424123412345678'; substr$_,0,-4,'*'x(length()-4)for$string; # 41 print $string;