in reply to Look Ahead:
$num = scalar reverse "1000000000000"; $num =~ s/(\d\d\d(?=\d))/\1,/g; print scalar reverse $num; [download]