Re: Super regexp to format numbers
Alexandre Jousset <[email protected]> Mon, 28 Aug 2006 22:53:21 +0200
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
A. Pagaltzis a écrit : > * Alexandre Jousset <[email protected]> [2006-08-28 18:15]: >> For the moment I have a (too) complicated sub spacify and I would >> like to simplify it to a regexp. > > It doesn’t have to be complicated, even without a regexp. > > scalar reverse join ' ', unpack '(A3)*', reverse $num; perl -e '$num=12345678.1234;print scalar reverse join " ", unpack "(A3)*", reverse $num;' => 1 234 567 8.1 234 It works only for integers... Thank you anyway... ;-) -- \^/ -/ O \---------------------------------------- | |/ \| Alexandre (Midnite) Jousset | -|___|----------------------------------------