in reply to file merge problem
Greetings,
Just a thought.
Updates
Thanks jdporter for the lower map suggestion. Much cleaner. Way better than the if(open (IN, $_)){#stuff} I was using.
BTW: we are Monks not Mongers :}
-InjunJoel
Just a thought.
This assumes your input filenames match the pattern "F*.dat" for the glob to work on.#!/usr/bin/perl -w use strict; my %d = map{ /^(\w+) /; $1, $_; }grep{ chomp; /^\w+ \d+/; }map{ local @ARGV = ($_); <>; }<F*.dat>; open(MRG, ">merge.dat") or die "Oops! There was a problem: $!"; print MRG, $d{$_}."\n" for(sort keys %d); close MRG;
Updates
Thanks jdporter for the lower map suggestion. Much cleaner. Way better than the if(open (IN, $_)){#stuff} I was using.
BTW: we are Monks not Mongers :}
-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
|
---|
In Section
Seekers of Perl Wisdom