diff options
| author | E. Choroba <choroba@matfyz.cz> | 2019-09-23 01:11:24 +0200 |
|---|---|---|
| committer | E. Choroba <choroba@matfyz.cz> | 2019-09-23 01:11:24 +0200 |
| commit | 060f39f0c1709690ebc447928dcc188be341d1d8 (patch) | |
| tree | a04174e0fac83b92abeaf12facf571e6e6e2feda /challenge-026 | |
| parent | ad4cab65239a0ee75103e3eb90a23175f9f7585b (diff) | |
| download | perlweeklychallenge-club-060f39f0c1709690ebc447928dcc188be341d1d8.tar.gz perlweeklychallenge-club-060f39f0c1709690ebc447928dcc188be341d1d8.tar.bz2 perlweeklychallenge-club-060f39f0c1709690ebc447928dcc188be341d1d8.zip | |
Optimize E. Choroba's solution to Stones and Jewels
Diffstat (limited to 'challenge-026')
| -rwxr-xr-x | challenge-026/e-choroba/perl5/ch-1.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-026/e-choroba/perl5/ch-1.pl b/challenge-026/e-choroba/perl5/ch-1.pl index 221d562b1c..a09275265b 100755 --- a/challenge-026/e-choroba/perl5/ch-1.pl +++ b/challenge-026/e-choroba/perl5/ch-1.pl @@ -7,8 +7,8 @@ use List::Util qw{ uniq }; sub count { my %args = @_; my $count = 0; - $count += () = $args{jewels} =~ /$_/g for uniq(split //, $args{stones}); - $count + $count += () = $args{jewels} =~ /[$args{stones}]/g; + return $count } use Test::More tests => 6; |
