in reply to why use a coderef?

From the code you have presented here, there is no apparent reason. Have you not perhaps taken it out of context?

Clint