in reply to Hash reference searching
The right way for hash ref is:
if( exists $HASH_REF->{$random_number} ){;} [download]
Also use Benchmark; for such tasks.