Skip to content

Instantly share code, notes, and snippets.

@sharifulin
Created November 10, 2009 17:50
Show Gist options
  • Save sharifulin/231091 to your computer and use it in GitHub Desktop.
Save sharifulin/231091 to your computer and use it in GitHub Desktop.
Simple Perl code of formating digital
#!/usr/bin/perl
use common::sense;
sub D($) {
for (scalar reverse shift) {
s/(\d{3})(?=\d)/$1 /g;
return scalar reverse;
}
}
say D 12345;
say D 123456;
say D 1234.56;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment