Olivier Wirz wrote:
> 
> Hello,

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

Just use the "numbers" in a numeric context:

$ perl -le'
for ( "000000", "000015" ) {
    print "String: ", $_;
    print "Number: ", $_ + 0;
    }
'
String: 000000
Number: 0
String: 000015
Number: 15



John
-- 
use Perl;
program
fulfillment

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