in reply to Need Help in processing a file
Some Perl Poetry for You:
use strict; my%a;my@a=split/ /,<DATA>; while(@a){ my($a,$n)=splice@a,0,2; $a{$a}=$n>$a{$a}?$n:$a{$a}; } print join " ", %a; __DATA__ a.txt 4 b.txt 3 z.txt 1 a.txt 5 b.txt 2 b.txt 4 z.txt 2
Now you only need to sort out the sorting...
UPDATE under Seussian Perl
In Section
Seekers of Perl Wisdom