Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Removing a chunk of HTML?

by kiruthika.bkite (Scribe)
on Mar 22, 2010 at 05:58 UTC ( #830028=note: print w/ replies, xml ) Need Help??


in reply to Removing a chunk of HTML?

In your code you have just modified the string.So changes will not be affected in a file.
If you want to modify file contents,use the module File::Inplace module.

Example

use strict; use warnings; use File::Inplace; my $editor = new File::Inplace(file=>"filename",suffix=>".bak"); while ($_=$editor->next_line) { if(s/(.*)/"welcome"/) { $editor->replace_line($_); } } $editor->commit;

If we mention suffix then it will create the backup file with the given extension.


Comment on Re: Removing a chunk of HTML?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-09-16 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (19 votes), past polls