There’s always eval, but… I have to ask; why do [you think] you
need this? I ask my question only semi rhetorically, because
whenever I thought I needed something like that, I typically found
that I was thinking about the problem wrong. In other words, a
design smell that led to a code smell.
You might also consider an array, and index by “greeting_no”.