473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

sorting ascending and descending

Hi there,

I am trying to sort an array hash on values. I pass a FORM tag and resolve
it to the array position to sort on. (see code below). Is there an easy way
to sort ascending or descending based on a new FORM value like ASC or DESC?
How would I add this functionality? I know I have to swap $a and $b, but I
have no idea where or rather how to add this to my code....

my $x=1;
if ($FORM{SORT} eq 'date') {$x=0;}
elsif ($FORM{SORT} eq 'email') {$x=5;}
elsif ($FORM{SORT} eq 'group') {$x=9;}
elsif ($FORM{SORT} eq 'url') {$x=4;}
foreach (sort{$LIST{$a}[$x] cmp $LIST{$b}[$x];} keys(%LIST)) {

(also posted alt.comp)

thx in advance, greets Seansan
Jul 19 '05 #1
1 5468
Seansan wrote:
Hi there,


This newsgroup is defunct.
Use comp.lang.perl.misc instead.
-Joe
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
3
by: Curtis | last post by:
I am trying to do a simple sort on a list view.With the listview control the first time I sort on the control it sorts the items but anytime after that it fails to sort. I'm sure this is a simple...
1
by: Eric | last post by:
I have a GridView control that I want to sort on multiple columns when I click a particular column. For example, I display Last name + ", " + First name in the first column and display id in the...
2
by: jediknight | last post by:
Hi, I have a listview which has columns of text and columns of numerical data. I need to be able to sort these columns into ascending/desending order whenever the user clicks on the column...
11
by: dwelden | last post by:
I have successfully used the sort lambda construct described in http://mail.python.org/pipermail/python-list/2006-April/377443.html. However, how do I take it one step further such that some values...
3
by: Don | last post by:
I have a "Report" that is created from a "Form". It prints a list of items, you may consider it a shopping list. In any event I use to run this in alphabetical order but have since decided to run...
3
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a question that maybe somebody can help me out. I have a gridview that is bound to a sqltable, and I have created two template columns. I am having problems getting the sorting to work....
1
by: l3d007 | last post by:
I used this example straight from msdn in a gridview that already sorts based on each column. For some reason I cannot get it to sort based on two sorting expressions.Is there some property of the...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
4
by: rajtalent | last post by:
hi all, I want to sort the colum when clicks the columnheader using vb.net 2005 .But i receive the following error "Error 1 Overload resolution failed because no accessible 'New' accepts...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.