Created
November 10, 2009 17:50
-
-
Save sharifulin/231091 to your computer and use it in GitHub Desktop.
Simple Perl code of formating digital
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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