Trekmy $tofind="s"; my $replacement="X"; my $variable="snaskes"; substr($variable, -1, 1) = $replacement if (substr($variable, -1, 1) e +q $tofind); print "$variable\n";
Update: Thanks to the CB folks for pointing out the mistake! Edited.
In reply to Re: Replace the last letter
by TrekNoid
in thread Replace the last letter
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |