or$_ = reverse(join(',', reverse($_) =~ /.{1,3}/g));
or$_ = join(',', split(/(?<=.)(?=(?:.{3})+\z)/, $_));
$_ =~ s/(?<=.)(?=(?:.{3})+\z)/,/g;
Update: Tested. Fixed. I knew I needed that \z.
Update: Added third solution, a simplification of the second.
In reply to Re: Regexp doubts
by ikegami
in thread Regexp doubts
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |