so how about sprintf?
and some code?
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
| [reply] |
A scalar should only lose the leading zeroes if you have attempted to treat it as a number somewhere along the line - and its a bit difficult to diagnose this as you don't show any code. Is it possible that you are doing something like adding zero to it or whatever > /J\
| [reply] |
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 | [reply] [d/l] |
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).
| [reply] |