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
In reply to Logic for sorting of this given array by ravish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |