If you always want the last letter, you could match:
As opposed to the substr use.$string =~ s/.$/X/; ## or $letter = 'X'; $string =~ s/.$/$letter/;
In reply to Re^3: Replace the last letter
by radiantmatrix
in thread Replace the last letter
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |