aboutsummaryrefslogtreecommitdiff
path: root/challenge-051/ryan-thompson/perl/ch-2.pl
blob: fd123f3e17d9fe5bc65d125d984a0c7f19ef4a0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env perl

# ch-2.p6 - Colourful numbers with 3 digits
#
# Ryan Thompson <rjt@cpan.org>

use 5.010;
use warnings;
use strict;

sub is_colourful3 {
    my ($x, $y, $z) = split //, $_[0];
    my %seen;
    $seen{$_}++ and return 0 for $x, $y, $z, $x*$y, $y*$z, $x*$y*$z;
    return 1;
}

say for grep is_colourful3($_), 111..987;