Just another Perl shrine | |
PerlMonks |
increment # but keep # of digits sameby yankeeblue (Novice) |
on Apr 26, 2005 at 14:27 UTC ( [id://451590]=perlquestion: print w/replies, xml ) | Need Help?? |
yankeeblue has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I have a dilemma involving updating a build number in a .rc2 file. I have other scripts that update the build number fine, but this one is different as I need the number to always remain 4 digits. The lines involving the build number are: VALUE "FileVersion", "0001.0000.0000.0001\0" VALUE "ProductVersion", "0001.0000.0000.0001\0" I need to bump up the last number in the last set of numbers, i.e. the first build would bump .0001\0" to .0002\0". I know how to do that. My problem occurs because that last set of numbers, .0001, needs to always remain 4 digits, never more. So for example build number 10 would need to look like: VALUE "FileVersion", "0001.0000.0000.0010\0" VALUE "ProductVersion", "0001.0000.0000.0010\0" For my other builds, it's easy, there is no restriction on the number of digits. For example I do the following (sorry if the code isn't the most efficient, I'm fairly new to Perl):
Back to
Seekers of Perl Wisdom
|
|