use warnings; use List::Util qw(uniq uniqnum); $x = sqrt 2.0; # Create $y with a less precise # approximation of sqrt 2 $y = "$x" + 0; #$y != $x print "unequivalent\n" if $x != $y; # But $x and $y both stringify # to 1.4142135623731, hence: $count = uniq($x, $y); print $count; __END__ # Outputs: unequivalent 1