in reply to passing data to variable in if statment

Use defined $var to see if a variable is defined or not. "" is different from undef