in reply to Merging 2 Hashes finding result sorted by one of the fields

An alternate approach lets command_line switches do most of the work.
C:\Users\Bill\forums\monks>type merg.pl #!perl -F/,/an use strict; use warnings; # our @animals; next if $F[0] eq 'NAME'; push @animals, [@F[0,1]] if $F[2] eq "herbivore\n"; END{ our @animals; printf "\n%-15s %10s\n\n", 'NAME', 'LEG_LENGTH'; printf "%-15s %4.2f\n" x scalar (@animals), map {@$_} sort {$$a[1] > $$b[1]} @animals; } C:\Users\Bill\forums\monks>perl merg.pl file1.txt file2.txt NAME LEG_LENGTH Triceratops 0.87 Hadrosaurus 1.20 Stegosaurus 1.40 Euoplocephalus 1.60
Bill