in reply to Seek Help Refactoring
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:
Then you'd just call it with the second value turned on if you wanted $self->{baz} tested.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; }
I am of course also little confused as to what the second push @foo, [ @bar ] is there for.
|
|---|