I love the simplicity and power of one-liners like
perl -pie 's/foo/bar/g;'Is there a way to invoke functionality like this from the middle of a longer perl script without forking another perl instance? I'm thinking along the lines of
sub delete_comments_from_file { my( $path ) = @_; eval "local @ARGV=qw{ -pie s/#.*//; $path };"; }
This would be quicker to write, clearer and less error prone than writing it all long-hand and I know the functionality is all there. I just don't know how to unlock it.
<°}}}>«<
In reply to Avoid re-invocation for -pie processing by seismofish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |