in reply to Calling a subroutine - which is most efficient?

No difference in efficiency.

Think instead about information flow and modularization and the likelihood of reuse in a slightly different context. The first sub knows more than the second sub - it knows it has to look up a certain fixed key, namely 'foo'. What if the various stuff turned out to be relevant in another situation, but where $baz didn't have this association with 'foo'? That's why my hunch is to prefer the second version.

But efficiency is not the issue.