you could take a look at
Term::TransKeys it seems to provide what you need without the need to interpret the return value of ReadKey. Otherwise you have to check for an escape and match the following sequence to the values returned using
jakobi's method above to determine the list of potential matches.