in reply to DBI Removing Leading Zeroes 0's
So the question is do you need to store all four digits, which would suggest you should use perhaps a char(4) type instead, or do you just need to output four digits? Any time you need to control formatting on a numerical output, you should probably turn to printf/sprintf, e.g.
~$ perl -e 'printf "%04d\n", 301' 0301
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|