Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(bbfu) (another way) Re: Replacing a given character starting with the xth occurence in a string

by bbfu (Curate)
on May 21, 2001 at 04:16 UTC ( [id://81886]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $nth = 3;
    my $rep = 1;
    my $chr = 'e';
    ...
    substr($str, $pos) =~ s/$chr/$rep/g;
    
    print $str;
    
  2. or download this
    my $s = "Terence and Philip are sweet\n";
    my $c = 'e';
    my $r = 1;
    ...
               Rate Quent's    Mine
    Quent's 26867/s      --    -24%
    Mine    35511/s     32%      --
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-18 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found