|Think about Loose Coupling|
Increment a string with letters and numbersby mrguy123 (Hermit)
|on Mar 28, 2013 at 08:44 UTC||Need Help??|
mrguy123 has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks, I have a string that looks like this:
I want to add one to the number - making this into
Now I know I can parse the digits in the string, add one and format it with sprintf to keep the zeroes. Then I can concatenate the letter part and it will work.
However, since this is Perl, there has to be a quicker and more elegant way to do this.
'You earnest Sage!' aloud they cried, 'your book you've read enough in!
'We wish to chop you into bits to mix you into Stuffin!'
Update: received some pretty cool and elegant answers. Thanks!!