A = B or C; # as "=" has higher precedence than "or" it binds it's # arguments "tighter", so this is equivalent to (A = B) or C; # so your expression is a disjunction # which executes the left operand (A = B) # being an assignment, which returns B in the end # and if that's false, the disjunction (or) # returns C, which is irrelevant, because that's in void # context # but you want A = (B or C) # because that's an assignment, an assignment # evaluates the right operand first (B or C) # which itself is a disjunction again and works as described # above, returning B if true, otherwise C # and that is then assigned to A, which must be an lvalue # that means in Perl my $page = ( $cgi->param("page") or "login" ); # or by using the high-precedence-OR "||" my $page = $cgi->param("page") || "login"; # because "||" has higher precedence than "="