James FitzGibbon > List-Uniq-0.11 > List::Uniq

Download:
List-Uniq-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.11   Source   Latest Release: List-Uniq-0.12

NAME ^

List::Uniq - extract the unique elements of a list

SYNOPSIS ^

  use List::Uniq ':all';

  @uniq = uniq(@list);

  $list = [ qw|foo bar baz foo| ];
  $uniq = uniq($list);

DESCRIPTION ^

List::Uniq extracts the unique elements of a list. This is a commonly re-written (or at least re-looked-up) idiom in Perl programs.

FUNCTIONS ^

uniq( { OPTIONS }, ele1, ele2, ..., eleN )

uniq() takes a list of elements and returns the unique elements of the list. Each element may be a scalar value or a reference to a list. List references will be flattened before the unique filter is applied.

If the first element is a hash reference it is taken to be a set of options that alter the way in which the unique filter is applied. The keys of the option set are:

The return value is a list of the unique elements if called in list context or a reference to a list of unique elements if called in scalar context.

EXAMPLES ^

EXPORTS ^

Nothing by default.

Optionally the uniq function.

Everything with the :all tag.

SEE ALSO ^

If you want to unique a list as you insert into it, see Array::Unique by Gabor Szabo.

This module was written out of a need to unique an array that was auto-vivified and thus not easily tied to Array::Unique.

AUTHOR ^

James FitzGibbon, Primus Telecommunications Canada Inc. <jfitzgibbon@primustel.ca>

CREDITS ^

The idioms used to unique lists are taken from recipe 4.7 in the Perl Cookbook, 2e., published by O'Reilly and Associates and from the Perl FAQ section 5.4.

I pretty much just glued it together in a way that I find easy to use. Hopefully you do too.

COPYRIGHT ^

Copyright (c) 2004-2008 Primus Telecommunications Canada Inc. All Rights Reserved.

This library is free software; you may use it under the same terms as perl itself.