use Data::Dumper; %foo=(BAZ=>1); print Dumper \%foo if $foo{BAR} || 1; print Dumper \%foo if @foo{BAR,BAZ} || 1;