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 avoiding work at the Monastery: (11)
As of 2014-12-18 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (59 votes), past polls