Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Dropping Leading Zeros

by Parham (Friar)
on Feb 05, 2002 at 23:57 UTC ( #143505=note: print w/ replies, xml ) Need Help??


in reply to Dropping Leading Zeros

i couldn't quite understand the question... but from the title of the post.. you want to remove leading zeros

$number = '00000000000005341390432'; $number =~ s/^0+//; print $number;
would output: 5341390432


Comment on Re: Dropping Leading Zeros
Download Code
Replies are listed 'Best First'.
Re: Re: Dropping Leading Zeros
by Sweeper (Pilgrim) on Feb 06, 2002 at 06:32 UTC
    i couldn't quite understand the question... but from the title of the post.. you want to remove leading zeros

    On the contrary, in his case, his program drops zeros that should be kept (zip codes, phone numbers). Your answer is valid, but off-topic. Yet, I did not downvote you, you wanted to help.

    Back to the question. I think that the real problem is that in the database, phone numbers and zip codes are described as numbers, and this is wrong. Phone numbers are strings, not numbers (consider 1-800-COLLECT), and zip codes are strings, not numbers (consider British and Canadian zip codes). Like gellyfish said, a few lines of code would help (do not post your whole program, yet, just select the few lines in question).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://143505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (18)
As of 2015-07-30 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls