http://qs321.pair.com?node_id=870156

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

Dear monks I need help (again),

Scenario is. I have a process listening which when it receives an input it forks and runs a module which inputs the data into a database.

In this module (package name DB_input ) i have used “use vars qw($dbh $timestamp $server)" . I am occasionally having mangled data go into the database and i wonder if it is because of the “use vars” ? Is it possible that when the listener forks 2 or more children at the same time, that the variables defined by “use vars” can end up being shared between the forked children ?

In which case would using "our" be better as i understand it is more tightly scoped ? thank you .