I have the following structure, %hash:

```
$VAR1 = {
           1 => 5,
           3 => 1,
           2 => 4,
           4 => 9,

        };

```

The keys of this hash represent id and the values represent number of access: **id => number of access**

I want to sort this using the number of access, in descending order, and store it in another hash. But I want the values to be the id this time. The keys should be the position in the ranking: **position in raking (from 1 to n) => id**

In this particular case:

```
$VAR2 = {
           1 => 4,
           2 => 1,
           3 => 2,
           4 => 3,
        };

```

How should I do this?