use constant DEBUG => 0; ... sub foo { sanity_check(...) if DEBUG; }