Mystik Gotan said:
Careful with the crossposting. This has nothing to do with CGI, and I
don't suppose my post will even get to the yahoo list.
> I'm in search for a solution. Let's say I have this array:
>
> @array (5, 6, 7, 89, 1, 0, 456, 298023, 56);
>
> Now, how can I get the biggest integers from this array and give them a
> string with their place. Let's say I have a foreach loop where I checked
> all the biggest integers (however, I don't know how) and I give them
> all a string like:
>
> $website_76 = 1; # position 1
> $website_87 = 2; # position 2
You don't want a bunch of separate variables. An array is the correct
data structure here.
@website[
map $_->[0],
sort { $b->[1] <=> $a->[1] }
map [ $_, $array[$_] ],
0 .. $#array
] = 1 .. @array;
This stores each element with its position in the array, sorts on the
element and then gets back its original position. This is used to
populate @website.
This might seem like voodoo, or it might be crystal clear. Ask about what
you don't know and can't work out yourself. But watch the crossposting.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]