my $var = ; if ($var eq "something") { # this code only gets called if $var contains "something" } else { # this code only gets called if $var doesn't contain "something" }