<sent before i finished>
>>>>> "JWK" == John W Krahn <[email protected]> writes:
JWK> There are a few ways to do what you require:
and you missed the simplest one so far (i did mention edit_file):
JWK> #!/usr/bin/perl
JWK> use strict;
JWK> use warnings;
use File::Slurp qw( edit_file ) ;
my $file = 'data.txt' ;
edit_file { s/Dood/Dude/g } $file ;
and if you need a counter:
my $change_cnt ;
edit_file { $change_cnt = s/Dood/Dude/g || 0 } $file ;
print "made $change_cnt changes to $file\n" ;
uri
--
Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com --
------------ Perl Developer Recruiting and Placement Services -------------
----- Perl Code Review, Architecture, Development, Training, Support -------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/