Commatizing numbers: Difference between revisions
Content deleted Content added
SqrtNegInf (talk | contribs) Added Perl example |
SqrtNegInf (talk | contribs) m →{{header|Perl}}: slight simplification |
||
Line 619: | Line 619: | ||
sub c_ins { |
sub c_ins { |
||
my($s,$by,$sep) = @_; |
my($s,$by,$sep) = @_; |
||
$ |
($c = reverse $s) =~ s/(.{$by})/$1$sep/g; |
||
$ |
$c =~ s/$sep$//; |
||
return reverse $c; |
|||
return reverse $s; |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |