mjn has asked for the wisdom of the Perl Monks concerning the following question:
I have a cgi which is parsing a csv file and displaying the data. It works great and has been satisfactory for a good many months. The people who requested the original work now are asking me to provide a few different views for the data. As it stands the data structure looks like this:
@{$data_struct{$build_no}} = ($build_name,$campus,$audit_date,$cutover +_date,$im)
Primary key is the building number. This is unique.
Since the building number is alpha numeric this is the sort i am using:
return $a =~ /^\w/ ? ($b =~ /^\w/ ?$a cmp $b : 1) : $a <=> $b;
It works fine but I am looking to provide the exact same information but sort(or resort) by building_name or cutover_date.
Has anyone done this sort of thing for hashrefs and can I do it without multiple data transformations? I am really lost as to how to do this...
Help, as always, is much appretiated.
_____________________
mjn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Sorting Complex Data Scructures
by jeffa (Bishop) on Sep 14, 2001 at 02:14 UTC | |
|
Re: Sorting Complex Data Scructures
by TGI (Parson) on Sep 14, 2001 at 02:27 UTC | |
|
Re: Sorting Complex Data Scructures
by derby (Abbot) on Sep 14, 2001 at 02:26 UTC | |
|
Re: Sorting Complex Data Scructures
by gt_reynolds (Initiate) on Sep 14, 2001 at 02:34 UTC | |
|
Re: Sorting Complex Data Scructures
by blakem (Monsignor) on Sep 14, 2001 at 02:24 UTC |