substr and string increment can make that even easier,
which prints "name_0010".my $file = 'name_0009'; substr($file, 5, 4)++; print $file, "\n";
The substr function is an lvalue, so any sort of mutator can be applied to it.
After Compline,
Zaxo
In reply to Re: adding 1 to a char of 1
by Zaxo
in thread adding 1 to a char of 1
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |