RosettaCodeData/Task/Self-describing-numbers/Perl/self-describing-numbers.pl
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

12 lines
247 B
Raku

sub is_selfdesc
{
local $_ = shift;
my @b = (0) x length;
$b[$_]++ for my @a = split //;
return "@a" eq "@b";
}
# check all numbers from 0 to 100k plus two 'big' ones
for (0 .. 100000, 3211000, 42101000) {
print "$_\n" if is_selfdesc($_);
}