Ron Barry/foodini.org
Latest Entry
prev:20090106 whole blog in context next:20090121 |
||
%20090107 Useful Script Night: Comify |
||
Yet another _very_ slightly useful script... I stick these things here because
it's the only way I'll know where to find them.
UPDATE 20090217: It would probably be more useful if people knew what it did.
Anything passed to the script on stdin will have groups of digits broken up with
commas into triplets:
1234567890 => 1,234,567,890
===== comify.pl
#!/usr/bin/perl
while($line = <STDIN>)
{
$line =~ s/([0-9])([0-9]{3})$/$1,$2/;
while ($line =~ s/([0-9])([0-9]{3}[^0-9])/$1,$2/) {}
print $line;
}
|
||
prev:20090106 whole blog in context next:20090121 |
||