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
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
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