"be consistent" | |
PerlMonks |
Regular Expression Helpby Anonymous Monk |
on Jun 28, 2005 at 17:44 UTC ( [id://470732]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, I have a string of numbers that comes into my program that supposable, it should have 6 digits long, like 123456, but sometimes it will come in to the program with 4 or 5 digits only, when that happens I have to add 0's to complement the string to have 6 digits. Like if a string of number comes in with 1234, I have to add 0's to it like, 001234, so it can have 6 digits. I have a regular expression that isn't working but my question is what is the best way to do this? The code above isn't working because in both cases it match the digits it finds. Thank you!
Back to
Seekers of Perl Wisdom
|
|