iweindesmedt has asked for the wisdom of the Perl Monks concerning the following question:
Hey Folks, I'm trying to find a way to easily pad numbers and strings with characters of your choice.
The method I'm using now is a simple sprintf command: sprintf("%03d", ++$i), which can for example be used in a loop.
Now, I stumbled upon this site where they say this can be easily done just by adding a few characters of code using the inventiveness of Perl.
I was wondering which that inventive method is. Any inputs on this?
Thanks, Iwein
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Clever Padding
by Ratazong (Monsignor) on Jan 27, 2010 at 11:29 UTC | |
by BioLion (Curate) on Jan 27, 2010 at 11:43 UTC | |
|
Re: Clever Padding
by ikegami (Patriarch) on Jan 27, 2010 at 18:36 UTC | |
|
Re: Clever Padding
by Anonymous Monk on Jan 27, 2010 at 10:51 UTC | |
|
Re: Clever Padding
by Marshall (Canon) on Jan 27, 2010 at 16:06 UTC | |
by tye (Sage) on Jan 27, 2010 at 22:05 UTC | |
by ikegami (Patriarch) on Jan 27, 2010 at 23:07 UTC | |
by tye (Sage) on Jan 27, 2010 at 23:32 UTC | |
by ikegami (Patriarch) on Jan 27, 2010 at 23:49 UTC | |
|
Re: Clever Padding
by iweindesmedt (Initiate) on Jan 28, 2010 at 08:30 UTC |