perl: Avoid "variable doesn't stay shared" warnings