in reply to Reading multiple files one line at a time from arguments

For learning purposes I would appreciate if some one can suggest a more concise approach (even if it comes at the cost of readability).

Taking you at you word; you can do this extremely concisely with a one-liner:

perl -ple1 file1 file2 ...

Or, if you prefer it as a 'full program'; type this into a file called ptype.pl:

#! perl -pl

And then on your command line:

ptype file1 file2 file3 file4 ...

If you're using *nix, then it would have to be (something like):

#!/usr/bin/perl -pl

With the advantage of being able to use wilcards:

ptype *.pl *.txt

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Reading multiple files one line at a time from arguments
by Anonymous Monk on Jun 19, 2014 at 04:26 UTC

    The advantage of being able to use *nix wildcards is a shell property (bash/tcsh/whatever) and irrelevant. The following works just as well:

    perl -ple1 *.pl *.txt