Use the sort function:

        print sort @array;

and for largest number first use:

        print reverse sort @array;

For your particular problem:

        @sorted_array = reverse sort @array;
        foreach (@sorted_array)
        {
                # whatever you want to do with each number goes here
        }

This kind of problem is usually covered in most beginners Perl books. Might be 
wise to invest in one ;-)

On Tuesday 10 December 2002 1:09 pm, Mystik Gotan wrote:
> Hiya,
>
> 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
>
> --------------
> Bob Erinkveld (Webmaster Insane Hosts)
> www.insane-hosts.net
> MSN: [EMAIL PROTECTED]
>
>
>
>
> _________________________________________________________________
> Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail
> SMS http://www.msn.nl/jumppage/

-- 
Geraint Jones

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to