exercism-perl5

Repository for my Perl 5 Exercism exercises
git clone git://git.samirparikh.com/exercism-perl5
Log | Files | Refs | README

commit 9f372bd9e5a26b55c1272d181d18b5abe090ee84
parent 79e02b630ffe9463f526e06f33a1e687354bece6
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Tue, 21 Dec 2021 23:19:20 +0000

update Sublist.pm a bit

Diffstat:
Msublist/Sublist.pm | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sublist/Sublist.pm b/sublist/Sublist.pm @@ -13,7 +13,7 @@ sub a_within_b { #print "checking $_ within @b ... "; #my $found = grep { /$_/ } @b; #say "found $found"; - return 0 unless (grep /^$element$/, @b); # grep needs expr that evanlates + return 0 unless (grep /^$element$/, @b); # grep needs expr that evaluates # to true or false } return 1; @@ -27,6 +27,7 @@ sub compare_lists { return "sublist" if (@a == 0 && @b > 0); # empty list within non empty list return "superlist" if (@a > 0 && @b == 0); # non empty list contains empty list return "equal" if (@a == @b && a_within_b(\@a, \@b)); + return "superlist" if (@a > @b && a_within_b(\@b, \@a)); return "sublist" if (a_within_b(\@a, \@b)); return "unequal"; }