ravish has asked for the wisdom of the Perl Monks concerning the following question:
I need help in sorting of array. My array is like this.
basically this is made for tree like structure, when i print this array , it prints like this :@array = ( { level => 1, department = 'Office of President', }, { level => 2, department = 'Recruiting', }, { level => 2, department = 'Software', }, { level => 3, department = 'MIS', }, { level => 3, department = 'System Operations', }, { level => 2, department = 'Pipe line', }, );
Currently the department is not sorted alphabetically beacuse my array is created on the basis of level and it is in sequence. Now i want to sort the department alphabetically. How will i do this. I want this array print like this :Office of the President Recruiting Software MIS System Operations PipeLine
ThanksOffice of the President (Make this as base level) PipeLine Recruiting Software MIS System Operations etc.....
update (broquaint): added <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Logic for sorting of this given array
by Zaxo (Archbishop) on Aug 28, 2003 at 05:35 UTC | |
|
Re: Logic for sorting of this given array
by gmax (Abbot) on Aug 28, 2003 at 10:58 UTC | |
|
Re: Logic for sorting of this given array
by broquaint (Abbot) on Aug 28, 2003 at 10:05 UTC | |
|
Re: Logic for sorting of this given array
by CombatSquirrel (Hermit) on Aug 28, 2003 at 10:36 UTC | |
by ravish (Acolyte) on Aug 29, 2003 at 05:20 UTC | |
by CombatSquirrel (Hermit) on Aug 29, 2003 at 06:55 UTC |