perlquestion
Cody Fendant
<p>Inspired by the fact that 2013 is the first year since 1987 which has four unique digits, what's your best code to
determine the number of unique digits in a number?
</p>
<p>Here's what I ended up with, skipping the <code>%unique</code> method:
</p>
<code>
$y = 2013;
($y = join('',sort(split(//,$y)))) =~ tr/0-9//s;
print "unique digits: " . length($y) . $/;
</code>
<p>I'm sure there's something smarter.</p>