Skip to content

Instantly share code, notes, and snippets.

@likhatskiy
Forked from sharifulin/Formating digital
Created November 20, 2009 10:51
Show Gist options
  • Save likhatskiy/239416 to your computer and use it in GitHub Desktop.
Save likhatskiy/239416 to your computer and use it in GitHub Desktop.
#!/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