in reply to "Commifying" a number
How about a recursive solution?
...no super-hideous while loop there, and no regex compilation either. ;-)sub commify { my($num) = @_; return $num if length($num)<4; return commify(substr($num,0,-3), $len).",".substr($num,-3,3); }
The only downside is that this only works for integers.
--
hiseldl
What time is it? It's Camel Time!
|
|---|