If this is mySQL for Perl, then...
my $s = "SELECT * FROM login WHERE id = '$userId' AND password = '$userPw'";
my is used in a strict enviroment (left out if not using strict.)
$s is a string variable (use $sql or $query instead, it's easier to debug later)
'login' is the name of the table (NOT a variable)
$userId and $userPW are variables.
Does that help?