From: "Uri Guttman" <u...@stemsystems.com>
> 
> hi all,
> 
> As with other releases of File::Slurp I think this list should be told
> about it since this module is so easy to use and makes your Perl much
> simpler and also faster.
> 
> uri
> 
> Have you ever wanted to use perl -pi inside perl? did you have the guts
> to localize $^I and @ARGV to do that? now you can do that with a simple
> call to edit_file or edit_file_lines in the new .018 release of
> File::Slurp. Now you can modify a file in place with a simple call.
> 
> edit_file reads a whole file into $_, calls its code block argument and
> writes $_ back out the file. 


Hi Uri,

Congratulations for the idea of adding this helpful feature to File::Slurp.

It is also useful for adding a string at the beginning of the file in an easy 
way, using something like:

edit_file { $_ = "first line\n" . $_ } 'file_name';

Octavian


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to