A
anthony
I had some code that would sort my keys in ascending order - no
problem.
Now what I have found is that when I introduce new values which are 6
digits (rather than 5 digits), it will place these are the beginning of
the list because they begin with the number 1.
My code is:
foreach $PackageToDeploy (sort(keys(%AparsToApply)))
{
print
"\t${PackageToDeploy}\t-\>\t$AparsToApply{$PackageToDeploy}\n";
}
which will produce the following:
57414 -> server1
57441 -> server1
57451 -> server1
57483 -> server1
57497 -> server1
57508 -> server1
57509 -> server1
Now when a new value is added to the array - lets say 101800. It will
put this at the top of the list rather than the bottom. It sorts on the
first digit first, but how can I get it to sort on the weight of the
number?
So what I want my output to be is:
57414 -> server1
57441 -> server1
57451 -> server1
57483 -> server1
57497 -> server1
57508 -> server1
57509 -> server1
101800 -> server1
I have had a look at the '$hash{$a} cmp $hash{b}' logic but it doesn't
seem to sort it the way I want, in fact it doesn't sort it at all.
problem.
Now what I have found is that when I introduce new values which are 6
digits (rather than 5 digits), it will place these are the beginning of
the list because they begin with the number 1.
My code is:
foreach $PackageToDeploy (sort(keys(%AparsToApply)))
{
"\t${PackageToDeploy}\t-\>\t$AparsToApply{$PackageToDeploy}\n";
}
which will produce the following:
57414 -> server1
57441 -> server1
57451 -> server1
57483 -> server1
57497 -> server1
57508 -> server1
57509 -> server1
Now when a new value is added to the array - lets say 101800. It will
put this at the top of the list rather than the bottom. It sorts on the
first digit first, but how can I get it to sort on the weight of the
number?
So what I want my output to be is:
57414 -> server1
57441 -> server1
57451 -> server1
57483 -> server1
57497 -> server1
57508 -> server1
57509 -> server1
101800 -> server1
I have had a look at the '$hash{$a} cmp $hash{b}' logic but it doesn't
seem to sort it the way I want, in fact it doesn't sort it at all.