D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] quick Perl question.

 

Martijn wrote:
>>> 1 9 11 42 6 7 85 etc.
>>>
>>> my question is how do I turn these into 01 09 11 42 06 07 85 etc.
>>> Numbers >99 will never occur
>> sprintf
> 
> In fact sprintf("%02d",$number) returns said value of $number. Its
> syntax is the same as printf, except that it returns it, rather than
> outputs it to the standard output.
> 
> See also: http://perldoc.perl.org/functions/sprintf.html
> 
> Martijn.
> 
Many thanks, just what I wanted :-)
James

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html