uniqint#

Remove subsequent duplicates by integer equality, preserving order.

תקציר#

my @subset = uniqint @values;
my $count  = uniqint @values;    # scalar context - count only

מה מוחזר#

In list context, the unique integer values in first-seen order - every input is truncated to its integer part before comparison, and the returned list itself contains integers (not the original SVs). undef is treated as 0.

דוגמאות#

my @u = uniqint 1.1, 1.9, 2.0;     # (1, 2)
my @u = uniqint '3', 3, 3.7;       # (3)
my $n = uniqint 1, 2, 2, 3;        # 3

הבדלים מן ה-upstream#

Fully compatible with upstream.

ראו גם#

  • uniqnum - full numerical (float) equality.

  • uniq - string-equality deduplication.