#! perl -slw use strict; my %cache; $cache{ sprintf( "%0.8x", rand() * 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 994758 keys between 00000000 and ffae0137