Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Replace the last letter

by TrekNoid (Pilgrim)
on Oct 07, 2004 at 18:44 UTC ( [id://397398]=note: print w/replies, xml ) Need Help??


in reply to Replace the last letter

In the 'yet another way to do it' category:
my $tofind="s"; my $replacement="X"; my $variable="snaskes"; substr($variable, -1, 1) = $replacement if (substr($variable, -1, 1) e +q $tofind); print "$variable\n";
Trek

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
    I noted this got downvoted, which is fine... I'm not seeking argument to that

    I would appreciate knowing, however, why. I'm always wanting to improve my skills, and if I've done something unknowingly wrong here, please let me know so I can correct it in the future

    I think I've shown in the past that I'm willing to learn from my own mistakes when shown why

    Maybe others here take offense to being corrected, but I appreciate it.

    Trek

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://397398]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found