in reply to Accessing a lexical variable of another file.

Hello, I'm captain-obvious-here :)

FWIW this isn't perl

// second.pl my $var = 1; // main.pl require("second.pl") // how do I access $var from here?

Also, while you can do things in perl like Accessing a lexical variable of another file. its not a good idea ... you already have the code, just change it :)