in reply to Leading Zeros
$foo = '1.23.456.78'; print join '.', map {sprintf("%03d", $_)} split(/\./, $foo);
Update: I was about to post a patch but tye beat me to it, so I'll just explain what it does. If you don't use the zero-pad in sprintf() then you get leading spaces, so you can substitute any desired character(s) for the spaces, and grep() works well for that. The code above becomes: print join '.', grep{s/ /-/g} map {sprintf("%03d", $_)} split(/\./, $foo);
--
I'd like to be able to assign to an luser
|
|---|