in reply to Re: Formatting a numberin thread Formatting a number
$num =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; [download]