in reply to Moving variables to config file

Change my to our and it works.

Paraphrasing "perldoc -f my",
the variable is local to the enclosing block, file, or "eval".

From perldoc -f our

our EXPR our TYPE EXPR our EXPR : ATTRS our TYPE EXPR : ATTRS "our" associates a simple name with a package variable in +the current package for use within the current scope. When "us +e strict 'vars'" is in effect, "our" lets you use declared g +lobal variables without qualifying them with package names, with +in the lexical scope of the "our" declaration. In this way "our" differs from "use vars", which is package scoped.
More discussion at this node.

Update:I would strongly recommend using poolpi's(++) method, below.

     "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom