in reply to rearranging a string.new

It's not "leaving the 2005 in front". Check your code, for example by running the below code:

my $string = '20050516'; my $newstring = substr($string,0,8). "!" . substr($string,0,4) . "!" . + substr($string,8,0); print $newstring;

If you look at the output of this snippet, you will see where your errors lie.