foreach $word (%tag) { $maxTagCnt = $tag{word} if $tag{word} lt $maxTagCnt; $minTagCnt = $tag{word} if $tag{word} gt $minTagCnt; }