# I want to make the control flow more natural here, if possible. # I'd like to eliminate the flag variable. # I'd like to eliminate the $tied variable. # I'd prefer not to call any function more than once, if possible. # # I realize these goals may conflict. # # There are four predicates: # magical # find_tied # find_regdata # var_exists # # Constraint: # You may not call find_tied() or find_regdata() unless # magical() has previously returned true. if (magical()) { my $adj_negative = 1; my $tied = find_tied(); if ($tied && var_exists()) { $adj_negative = 0; } if ($tied || find_regdata()) { if ($adj_negative) { adjust() } return TIEDSV; } } adjust(); ...more code...