use strict; use warnings; my %data= ( 'a' => 'b', 'c' => 'd', 'e' => 'f' ); my @keylen = keys %data; print $#keylen;