I have a script that reads of a global config file using Config::Tiny. Based on selection variable my script chooses a sub routine for either SQLite, MySQL or PgSQL.
Right now the config file is read at the top of the script and variables are set outside of the sub routines. But considering the MySQL vars have nothing to do with PgSQL or SQLite I wanted to set private vars in the sub routines. The only thing I am wondering is what happens to the vars once the sub routine has ran its course? Do they get removed?
Variables declared in subroutines will not exist after the subroutine returns. Their memory will be released, and any referenced values will be eligible for garbage collection (assuming that nothing else references those values).