in reply to Long list is long
You don't really need the arrays @p, @q and @i, you could just do this:
my %f; for my $file ( @files ) { open my $IN, '<', $file or die "Cannot open '$file' because: $!"; while ( <$IN> ) { /^(.*)\t(.*)$/ && $f{ $1 } += $2; } } open my $OUT, '>', $outpath or die "Cannot open '$outpath' because: $! +"; for my $key ( sort { $f{ $b } <=> $f{ $a } } keys %f ) { print $OUT "$key\t$f{$key}\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Long list is long
by eyepopslikeamosquito (Archbishop) on Oct 30, 2022 at 05:44 UTC | |
Re^2: Long list is long
by Chuma (Scribe) on Oct 30, 2022 at 12:49 UTC |