I guess I sort of just saw the question and wanted to see if I could quickly pound out an answer. I really should have explained things more, probably, though I didn't really think my result was that obfu. I definitely didn't mean to confuse anyone.
Also, I didn't use *.part-* since it didn't seem like the OP was looking to merge all the files in the dir, since the existence of file.mno.part-5.txt seems to imply the existence of file.mno.part-1.txt, file.mno.part-2.txt, etc., but only the former was listed. Incidentally, I just noticed that the OP wanted to use a file as input, in which case she or he could just replace
for(@ARGV){ with
while(<>){chomp; and use the file with the file locations as the only argument. For those that don't know, the diamond thingie is the magical input dingdong that pulls in input from the files listed in the arguments. When used in a while context like this, its the same as saying
while (defined($_ = <>)) { - which is sort of magical too.
Anyway, Graff, thanks for pulling me back down to earth a little to sort of remember that we're all here to share and learn. Of course, apologies to any who may have been confused.
Best,
-Adam
P.S. To anyone interested, you can also remove the
close()s, since
open() close()s filehandles of the same name should they be open, and any filehandles remaining open are closed at the scripts end.
--
By a scallop's forelocks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.