http://www.perlmonks.org?node_id=194587

rzward has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have a script that makes heavy use of 'local' rather than 'my'. This is because the script was originally written in 1996 and supporting Perl 4 was important. I have updated and enhanced the script quite a bit and have up to now decided to not use 'my' because I didn't see a real need.

I would now like to use 'use strict' but 'use strict' doesn't regard 'local' as a way of defining a variable, so I get many "... requires explicit package name at..." messages.

I remember reading somewhere that 'local' works whereas 'my' doesn't when dealing with file handles... Am I remembering incorrectly? I can't find this.

I am now considering changing all occurrences of 'local' in the script to 'my' but am worried that this will break the code. Are there places where I can read about the differences between 'my' and 'local'?

Thanks in advance.

Richard