I have a hash array that needs to be sorted.
Problem is, I can't get the elements to sort themselves correctly as I can't just sort by the keys.
My hash data looks like this:
key value
12345678 123, 12:00 25/7/2005: myemail@dumpster.org
12345680 124, 12:01 25/7/2005: another@dumpster.org
Key: 8 char value that can include A-F and 0-9
Value: index number, time, date, email address
I want to sort by the index number.
I have this so far:
$flatList is passed out of the function and printed to screen.
It works, but the key value is omitted.
I know that I am not passing the $_ value correctly and thats where I need some hints.
Thanks.
Alchemy is easy with Perl!:
s/lead/gold/g
Problem is, I can't get the elements to sort themselves correctly as I can't just sort by the keys.
My hash data looks like this:
key value
12345678 123, 12:00 25/7/2005: myemail@dumpster.org
12345680 124, 12:01 25/7/2005: another@dumpster.org
Key: 8 char value that can include A-F and 0-9
Value: index number, time, date, email address
I want to sort by the index number.
I have this so far:
Code:
foreach (sort {(split(/,/,$a))[0] <=> (split(/,/,$b))[0]} values %emailList){
$flatList .= "$_: $emailList{$_} <br>";
}
$flatList is passed out of the function and printed to screen.
It works, but the key value is omitted.
I know that I am not passing the $_ value correctly and thats where I need some hints.
Thanks.
Alchemy is easy with Perl!:
s/lead/gold/g