if ( expense_in_range($request) and is_expense_account($x) ) { ... } sub expense_in_range { my $expense = shift; return ( defined $expense and $expense > 0 and $expense < EXPENSE_LIMIT ) ? 1 : 0; } sub is_expense_account { my $account = shift; return $account =~ /^[Gg]\d{3}-\w{5,6}+/ ? 1 : 0; }