#!/usr/bin/perl use warnings; use strict; my %hash = ( a => 00, b => 01, c => 02, d => 03, e => 04, f => 05, g => 06 ); my @keys = ('c'..'f'); print $hash{$keys[int(rand(@keys))]} . "\n";