You could
- pass the $dbh into the functions as a parameter.
- Declare my $dbh at the beginning of the script if you don't need to share it with other packages/files
- Make it a package var. There is nothing wrong with this when it makes sense.
Connections are slow, it would be ridiculous to keep establishing db connections for the sake of dogma.
-Lee
"To be civilized is to deny one's nature."