in reply to Avoid re-invocation for -pie processing
Hi, use Path::Tiny and edit_lines().
Output:use strict; use warnings; use feature 'say'; use Path::Tiny; my $file = path('file.txt'); $file->spew("foo bar\nfoo bar"); $file->edit_lines(sub{s/bar/baz/}); say $file->slurp;
foo baz foo baz
Hope this helps!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Avoid re-invocation for -pie processing
by seismofish (Novice) on Jan 08, 2024 at 11:02 UTC |