use constant = { ... } sub routine { my $mouse_mode = set_mouse_mode; ... ... END { if ( $mouse_mode ) { print UNSET_EXT_MODE_MOUSE_1005 if $mouse_mode == 3; print UNSET_SGR_EXT_MODE_MOUSE_1006 if $mouse_mode == 4; print UNSET_ANY_EVENT_MOUSE_1003; } } }