Problems? Is your data what you think it is? | |
PerlMonks |
Re^3: compare and merge filesby Adrade (Pilgrim) |
on Feb 06, 2006 at 12:05 UTC ( [id://528195]=note: print w/replies, xml ) | Need Help?? |
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. --
In Section
Seekers of Perl Wisdom
|
|