[Wellington-pm] How to cure "variable will not stay shared?

Lesley Longhurst lrw at clear.net.nz
Thu Nov 3 15:35:37 PDT 2011

Hi mongers,

So, I'm looking at some nasty legacy code left behind by Mordac. I added 
"use warnings; use diagnostics" and got a pile of these warnings.  From 
what I've read so far, it seems that they are caused by a subroutine 
being defined inside a subroutine. The diagnostics text suggests making 
the inner subroutine anonymous, but I don't think that's going to work 
because it's called by name many times.

Am I likely to make matters worse if I just take the inner sub and move 
it outside the outer sub? Most of the variables are defined without "my" 
and there is no other sub with the same name.

Lesley Longhurst (previously Walker)
Linux Systems Administrator
Opus International Consultants Ltd
Email lesley.longhurst at opus.co.nz
Tel +64 4 471 7002, Fax +64 4 473 3017
Level 9  Majestic Centre, 100 Willis Street, PO Box 12 343
Wellington, New Zealand

More information about the Wellington-pm mailing list