[Thamesvalley-pm] Thamesvalley-pm Digest, Vol 19, Issue 1

Duncan Kendall dk-thamesvalley-pm at bdksol.co.uk
Wed Jan 7 00:21:38 PST 2009


> Date: Tue, 06 Jan 2009 13:23:39 +0000
> From: Charlie Harvey <charlie at newint.org>
>
> Its not especially elegant, but:
>
> $len = 10;
> $string = '0' x ($len - length $num) . $num;

Yes. That's pretty much what I came up with.

Thanks.


> Date: Tue, 6 Jan 2009 13:38:59 +0000
> From: Smylers <Smylers at stripey.com>
>
> Why does sprintf need to know that it's an integer?  Using %0*s appears
> to do what you want.

Doh! That is much better - and far too obvious for me to see.

Thanks.



More information about the Thamesvalley-pm mailing list