Better version than under Re: Need Help in processing a file
use strict; # just kidding my%hat;my@cat=split/ /,<DATA>; while(@cat){ my($cat=>$hat)=splice@cat,0,2; $hat{$cat}=$hat>$hat{$cat}?$hat:$hat{$cat}; } print join" ",%hat; # and that was that __DATA__ a.txt 4 b.txt 3 z.txt 1 a.txt 5 b.txt 2 b.txt 4 z.txt 2
In reply to Seussian Perl by hdb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |