hmerrill: I was under the impression that if you had very large scalar (e.g. $template contains a 100kb template) it was more efficient to pass a reference than to pass the whole scalar, since no memory is being copied. Or am I confused on this point?
No, your impression is probably correct - I've never really used scalars with really *large* values, so that's probably why I didn't think of that. In that case, you *should* probably pass a reference to the scalar like you were doing in the first place. Sorry if I confused you.