#! perl -slw use strict; my %cache; $cache{ sprintf("%0.8x",rand()*0xffffffff) } = undef for 1 .. 1_000_000; printf "1 million attempts produced %d keys\n", scalar keys %cache; printf "between %s and %s\n", (sort keys %cache)[ 0, -1 ]; __END__ P:\test>junk 1 million attempts produced 32768 keys between 00000000 and fffdffff