# first param is ref to hash, other params are valid keys # if invalid key is found, return "invalid key:$key" sub check_keys($@) { my @l1 = sort(keys(%{ shift(@_) })); my @l2 = sort( @_ ); while (@l1) { return "invalid key:$l1[0]" if (not @l2) or ($l2[0] gt $l1[0]); shift @l1 while @l1 and @l2 and ($l1[0] eq $l2[0]); shift @l2 while @l1 and @l2 and ($l1[0] gt $l2[0]); } return ''; }