use warnings; use strict; # Give the compiler an indication the variable may be used use vars qw/$r/; if (!$r){ do something }