use strict; use warnings; my $eps = 1e-10; sub distinct { return 1 if @_<2; # lists of 1 or empty lists never have duplicates my $first = shift; for( @_ ) { return 0 if abs($first - $_)<$eps; } return distinct( @_ ); } my @n = ( 1, 2, 3, 4, 4 ); print distinct( @n );