$ perl -i -ple '$_.="\n" if $. % 4 == 0; close ARGV if eof' -- FILES #### { # new scope for local local *ARGV; @ARGV = @files; local $^I = ""; # -i command line switch while (<>) { print $_; print "\n" if $. % 4 == 0; close ARGV if eof; } }