logging: Check if typescripts with a similar name already exist
[sunny256-utils.git] / commify
blobee9558f470b43531b36542af40488bd663d9162f
1 #!/usr/bin/env perl
3 # commify
4 # File ID: 895db0b6-5d37-11df-92d4-90e6ba3022ac
5 # Setter inn understrek i nummer.
7 use strict;
8 use warnings;
9 use Getopt::Std;
11 our $opt_s;
13 getopts('s:');
15 defined($opt_s) || ($opt_s = "_");
17 while (<>) {
18 s/(\d{3,})/commify($1)/ge;
19 print;
22 sub commify {
23 my $Str = reverse $_[0];
24 $Str =~ s/(\d\d\d)(?=\d)(?!\d*\,)/$1$opt_s/g;
25 return scalar reverse $Str;
26 } # commify()