Re: Leading zeroes

2004-01-10 Thread John W. Krahn
Olivier Wirz wrote: > > Hello, Hello, > How can I suppress the leading zeroes, except one when all positions are 0; > for example: > > 15 will be 15 > 00 will be 0 Just use the "numbers" in a numeric context: $ perl -le' for ( "00", "15" ) { print "String: ", $_; print

Re: Leading zeroes

2004-01-10 Thread James Edward Gray II
On Jan 10, 2004, at 8:34 AM, Olivier Wirz wrote: Hello, How can I suppress the leading zeroes, except one when all positions are 0; for example: 15 will be 15 00 will be 0 See if this one-liner gets you going: perl -le 'foreach (@ARGV) { s/^0+([0-9])/$1/; print; }' 15 00 15 0 J

Re: Leading zeroes

2004-01-10 Thread Andrew Gaffney
Olivier Wirz wrote: Hello, How can I suppress the leading zeroes, except one when all positions are 0; for example: 15 will be 15 00 will be 0 This is a pretty vague question. How are you outputting the numbers? Are you writing to a file, using print, using printf, etc.? -- Andrew Gaffne