in reply to Replace the last letter
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace the last letter
by TrekNoid (Pilgrim) on Oct 07, 2004 at 19:07 UTC |