$string=~s/(....)/$1-/s; [download]
In reply to Re: Adding formatting to a string by ambrus in thread Adding formatting to a string by Clownburner