Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Replacing a specfied instance of a pattern in a string (2 more)

by tye (Sage)
on Jul 15, 2005 at 05:17 UTC ( [id://475118]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $i= 0;
    $str =~ s/(...)/ 3 == ++$i ? 'fish' : $1 /ge;
    
  2. or download this
    my $i = 3;
    0 while $str =~ /fsih/gi && --$i;
    substr( $str, $-[0], $+[0]-$-[0], 'fish' )   if  ! $i;
    

Log In?
Username:
Password:

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

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

    No recent polls found