Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: One to one file output idiom

by shmem (Chancellor)
on Jan 15, 2020 at 20:30 UTC ( #11111458=note: print w/replies, xml ) Need Help??


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'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11111458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2020-05-26 18:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?