Oh, no, actually, I know quite about Perl. The problem is, I hardly have got any experience in programming, I read a lot. I've got 3 perl books and wasn't just thinking at the idea of using sort(). Thanks guys.



--------------
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]





From: Geraint Jones <[EMAIL PROTECTED]>
To: "Mystik Gotan" <[EMAIL PROTECTED]>, [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: How to get the biggest integers from an array?
Date: Tue, 10 Dec 2002 14:39:42 +0000

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]

_________________________________________________________________
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl/worldwide.asp


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

Reply via email to