in reply to converting hash to shuffled array

That's quite inefficient. Why not something like:
my $key = (keys %db) [rand keys %db]; print "<a href = '$db{$key}'><img src = '/images/$key'></a>";

Abigail

Replies are listed 'Best First'.
Re: Re: converting hash to shuffled array
by shenme (Priest) on Sep 12, 2003 at 05:16 UTC
    I gotta ask - where might be an explanation of the implicit int() within the subscripting []'s?   It's so beautiful and dreadful at the same time.

    I've seen something like this done before, a long time ago, but I guess I just accepted it as 'magic'.   I was reminded on CB that a FP number wouldn't make any sense as a subscript and so the DWIMish gnomes happily fixed the value.   But sometimes I get this panicky feeling that if the magic isn't documented, it'll run away when I'm not looking.