sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
Is there a better method to doing this? Better = easier to maintain but not harder to understand.
Thanks everyone.
my @imagearray; # array for everything in database foreach (keys %db) { push(@imagearray, "$_||$db{$_}"; # $imagetitle || $url } my @shuffled_array = shuffle(@imagearray); # shuffle the array my($name, $url) = split("||", "$shuffled_array[0]"); # split array on +|| print qq(<a href="$url"><img src="/images/$name"></a>);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: converting hash to shuffled array
by Abigail-II (Bishop) on Sep 11, 2003 at 18:03 UTC | |
by shenme (Priest) on Sep 12, 2003 at 05:16 UTC | |
|
Re: converting hash to shuffled array
by tcf22 (Priest) on Sep 11, 2003 at 18:04 UTC | |
|
Re: converting hash to shuffled array
by Enlil (Parson) on Sep 11, 2003 at 18:09 UTC | |
|
Re: converting hash to shuffled array
by davido (Cardinal) on Sep 11, 2003 at 18:06 UTC | |
|
Re: converting hash to shuffled array
by atcroft (Abbot) on Sep 11, 2003 at 18:10 UTC | |
|
Re: converting hash to shuffled array
by BrowserUk (Patriarch) on Sep 11, 2003 at 19:47 UTC | |
by sulfericacid (Deacon) on Sep 12, 2003 at 03:43 UTC | |
by BrowserUk (Patriarch) on Sep 12, 2003 at 04:19 UTC | |
|
Re: converting hash to shuffled array
by Cody Pendant (Prior) on Sep 11, 2003 at 22:40 UTC |