in reply to How to print specific word from array/hash?

If you already have the %colours hash that you describe, then the best is to reverse it, as shown by Athanasius.

But if you build the hash for this purpose, then, the best is probably to build it the right way from the start:

my %colours = ( 1 => "blue", 2 => "green", ... );

Yet, if your indices are all small integers, you might as well use an array:

my @colours = qw/ blue green red pink purple /;
bearing in mind, though, that array subscripts start at 0, so that you might want to use a dummy value for array subscript 0 if you need your colors to start at index 1:
my @colours = qw/ nil blue green red pink purple /;
Update: removed some commas left in the qw// list. Thanks to the monks who pointed out this type.