in reply to keys with an expression

... this is ... a question concerning the kinds of expressions I can feed into keys.

Answers to questions like this can be had by Reading about keys and other, er, keywords (and much else besides) in The Fine Manual(s). (And BTW: Feeding keys et al a hash/array reference works from 5.14 on.)