Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: One to one file output idiom

by LanX (Sage)
on Jan 15, 2020 at 18:44 UTC ( #11111455=note: print w/replies, xml ) Need Help??


in reply to Re: One to one file output idiom
in thread One to one file output idiom

maybe try $. to catch the first line per file, like
C:\tmp\files>perl -nE"say qq($.--$ARGV) if $.==1; $.=0 if eof " a b c 1--a 1--b 1--c

Unfortunately I need to reset $. at the end of each file, which is kind of hacky! :/

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^3: One to one file output idiom
by Eily (Monsignor) on Jan 16, 2020 at 09:06 UTC

    Closing ARGV before it gets opened again would be the non hacky thing way to do it since it's shown in the doc, although it's a bit longer.

    Edit: choroba pointed out it was shown in the doc for eof not open

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-01-22 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?