Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-07-06 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls