Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Replace strings in text file

by tybalt89 (Prior)
on Sep 21, 2018 at 09:26 UTC ( #1222791=note: print w/replies, xml ) Need Help??


in reply to Replace strings in text file

And here's the Path::Tiny version...

#!/usr/bin/perl # https://perlmonks.org/?node_id=1222734 use strict; use warnings; use Path::Tiny; my $lookuptxtfile = 'd.lookuptxtfile'; path($lookuptxtfile)->spew(<<END); one two The action failed. three The action failed. twice The action failed. four END print path($lookuptxtfile)->slurp; print "\n"; # end setup for testing # start actual code path($lookuptxtfile)->edit( sub { s/The action failed./failed_build/g +} ); # end actual code print path($lookuptxtfile)->slurp; # debug print

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-05-25 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?