in reply to passing a scalar to a function

Useful habit: when you type

sub mycheck {

go on and type

my () = @_;

right away. In the present case you would fill in the list of receiving variables with $db:

my ($db) = @_;

Since you want the default value to be the null string, you can go on and say

$db ||= "";