http://qs321.pair.com?node_id=11111458


in reply to One to one file output idiom

Just open a new file whenever the current $ARGV isn't the same as the remembered one (which can be undefined):

perl -p -e '$o ne $ARGV and open STDOUT,">","$ARGV.out" and $o = $ARGV +; s/perl6/raku/;' foo bar baz

When the input file changes ($ARGV), a new output file is opened. Of course, a file can be run instead of -e '$proggy'.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'