That warning didn't look familiar so I poked around a little on google and it turns out that I misremembered it backwards... The actual warning I was thinking of was "Exiting subroutine via next", for which the solution is to exit from the sub using return instead of next... So return was the cure for my half-remembered warning rather than the cause.