in reply to Accessing $a and $b of 'sort' across package boundaries

Update: this answers the wrong question. I didn't read the question. Shame on me. Sorry.

Go see what the pure-perl version of &List::Util::reduce does.

It aliases the $a and $b in the scope of the caller to temporary scalars. I think that's faster then reading the original scalars. The best way would probably be if you make lexical aliases to those scalars, but that's out of question in a pure perl implementation which is used as a failback for the XS version.