Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Search and replace query

by cdarke (Prior)
on Aug 26, 2011 at 10:23 UTC ( #922564=note: print w/replies, xml ) Need Help??


in reply to Search and replace query

Is the condition the number of occurences "the third time this text appears" or when "it appears after a line, lets say, <bindname>abcde<\/bindname>"?

Which condition you require will determine the type if if statement you require.

Replies are listed 'Best First'.
Re^2: Search and replace query
by pvaldes (Chaplain) on Aug 26, 2011 at 11:18 UTC
    foreach my $line ( @fileArr ) { next if $line =~ m/<bindname>abcde<\/bindname><bindpass>welcom +e<\/bindpass> $line =~ s/<bindpass>welcome<\/bindpass>/<bindpass>Welcome1<\/ +bindpass/ }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2019-11-19 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (95 votes). Check out past polls.

    Notices?