Not answering your immediate question, but a Perl idiom worth knowing is the edit inplace:
@ARGV = @files; $^I = '.bak'; while (<>) { # do something with each line of each file # The original line contents is in $_ # print prints to the new version of the file s/foo/bar/g; print; }
Update: Fix @ARGV - thanks QM :)
In reply to Re: Run a variable as a line of code?
by GrandFather
in thread Run a variable as a line of code?
by lev36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |