in reply to Re: Formatting a number
in thread Formatting a number

Thanks - missed that (and I guess I should have searched harder as this is a command problem: apologies). Nice regex though - finally see the point of \G ;)
$num =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
Thanks.