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:


000015 will be 15
000000 will be 0

See if this one-liner gets you going:


perl -le 'foreach (@ARGV) { s/^0+([0-9])/$1/; print; }' 000015 000000
15
0

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to