Sha256: f10fd6e0d8d951214a089a7bc4a8ebd82fa3ec75b5e2d7818dcc1584d41433ef

Contents?: true

Size: 332 Bytes

Versions: 42

Compression:

Stored size: 332 Bytes

Contents

package Raindrops 1;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT_OK = qw(raindrop);

sub raindrop {
  my ($num) = @_;
  my %sounds = (Pling => 3, Plang => 5, Plong => 7);
  my $str = '';
  foreach (qw(Pling Plang Plong)) {
    if ($num % $sounds{$_} == 0) {
      $str .= $_;
    }
  }
  return $str || $num;
}

1;

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/perl5/exercises/raindrops/.meta/solutions/Raindrops.pm
trackler-2.2.1.138 tracks/perl5/exercises/raindrops/.meta/solutions/Raindrops.pm