#!/usr/bin/perl -w use strict; use warnings; my %hash = ( 100 => 'foo', 200 => 'bar', 300 => 'foobar', 400 => 'foofoo', 500 => 'barbar', ); my $test = '300'; my @keys = sort { $a <=> $b } keys %hash ; my %keys_nummeriert ; @keys_nummeriert{@keys} = ( 0 .. $#keys ) ; printf "Index von value '%s' ist '%d'\n" , $test , $keys_nummeriert{$test} ;