#!/usr/bin/perl -w use strict; my %hash = (foo=>1, bar=>2, baz=>3); print $hash{[keys %hash]->[int rand keys %hash]};