in reply to require function not passing lexical variable

require FILENAME behaves similar to do FILENAME, and if you check out perldoc -f do you'll see:

It also differs in that code evaluated with "do FILENAME" cannot see lexicals in the enclosing scope; "eval STRING" does.