Just another Perl shrine | |
PerlMonks |
Re: How to convert a string with regex to a string with a fixed length?by lodin (Hermit) |
on Jul 29, 2008 at 16:17 UTC ( [id://700845]=note: print w/replies, xml ) | Need Help?? |
I don't quite understand the question. A regexp cannot change the string, it can only extract portions of the string. If you mean an substutation and you can evaluate the substitution part (but why would you then be limited to evaluate inside a s///?), you can use the following simple technique.
You just create a new string with all the zeros you could possibly need at the end, and then take the chars from the beginning.
lodin
In Section
Seekers of Perl Wisdom
|
|