My apologies to all for not RTFM (or more precisely, not finding the relevant section to read).
TGI, thanks for your additional remarks concerning passing scalars. I don't use global file handles any more, so passing just the scalar will work perfectly.