in reply to Seek Help Refactoring

You seem to have the structure:

if a and b and c then do...
if !a then do...

Which, if I'm not messing up my logic analysis, can be simplified to:

if !a or b and c then do...

Both functions should be simplified down to:

sub alphabeta { my ($self, $test) = @_; ... foreach ... if (!... || ... && ...) { push @foo, [ @bar ] if !$test || $self->{baz} eq $gamma; } } push @foo, [ @bar ] if !$test || $self->{baz} eq $gamma; return \@foo; }
Then you'd just call it with the second value turned on if you wanted $self->{baz} tested.

I am of course also little confused as to what the second push @foo, [ @bar ] is there for.