in reply to setting hash keys by array

$hash{$_}++ foreach @array

Update:
Misunderstood the question. Ignore me :P