Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Compact multi-line inplace file edit search and replace

by chanio (Priest)
on Aug 23, 2005 at 06:18 UTC ( [id://485829]=note: print w/replies, xml ) Need Help??


in reply to Compact multi-line inplace file edit search and replace

Very creative!

But I guess that you also need to list the last part of the file.

That is, like in a huge

split
, ain't me right? It looks good for raw XML replacements :) .

(updated)

Sorry, I still can't get what the my $matched= chomp; really does... I need more practice, I guess [-(.

{ \ ( ' v ' ) / }
( \ _ / ) _ _ _ _ ` ( ) ' _ _ _ _
( = ( ^ Y ^ ) = ( _ _ ^ ^ ^ ^
_ _ _ _ \ _ ( m _ _ _ m ) _ _ _ _ _ _ _ _ _ ) c h i a n o , a l b e r t o
Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established

Replies are listed 'Best First'.
Re^2: Compact multi-line inplace file edit search and replace
by GrandFather (Saint) on Aug 23, 2005 at 07:40 UTC

    Actually you do get the last part of the source file. If there is just one instance of the match text in the original file then the first itteration of the loop prints the part before the match and the replacement text. The second itteration prints the part of the original file following the match text, but does not insert the replacement text.


    Perl is Huffman encoded by design.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-19 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found