Re: Pad Number with Leading Zeros

2001-09-26 Thread Brett W. McCoy
On Wed, 26 Sep 2001, Schoeneman, Carl wrote: > Is there a way to pad a number with leading zeros with 1 command rather than > the 2 I used below? It looks like you're supposed to be able to zero-fill > with sprintf but I couldn't figure it out. $x = 1234; printf "%06d\n", $x prints 001234 --

RE: Pad Number with Leading Zeros

2001-09-26 Thread Wagner-David
Change %6s to %06s and it will pad with zeros. Wags ;) -Original Message- From: Schoeneman, Carl [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 26, 2001 12:40 To: Perl Beginners (E-mail) Subject: Pad Number with Leading Zeros Hello. Is there a way to pad a number with

Pad Number with Leading Zeros

2001-09-26 Thread Schoeneman, Carl
Hello. Is there a way to pad a number with leading zeros with 1 command rather than the 2 I used below? It looks like you're supposed to be able to zero-fill with sprintf but I couldn't figure it out. #!/bin/perl -wd $f = 1234; $g = sprintf "%6s", $f; $g =~ s/ /0/g;