<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: uniq code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 14:35:26 GMT</pubDate>
    <description>DZone Snippets: uniq code</description>
    <item>
      <title>And then there is always CPAN  ...</title>
      <link>http://snippets.dzone.com/posts/show/1353</link>
      <description>// ...for those who want to keep it simple&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;use Uniq;&lt;br /&gt;my @u_s_users=uniq sort @users;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 05 Feb 2006 10:06:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1353</guid>
      <author>lucian ()</author>
    </item>
    <item>
      <title>'uniq' array</title>
      <link>http://snippets.dzone.com/posts/show/354</link>
      <description>A much more idiomatic and efficient version of the 'uniq array' code at &lt;a href="http://www.bigbold.com/snippets/posts/show/152 "&gt;152&lt;/a&gt; is:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  # Input: @list&lt;br /&gt;  # Output: @uniqed&lt;br /&gt;  my %seen;&lt;br /&gt;  my @uniqed = grep !$seen{$_}++, @list;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Mon, 30 May 2005 21:51:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/354</guid>
      <author>TMtm (Tony Bowden)</author>
    </item>
    <item>
      <title>Efficient 'uniq' snippet</title>
      <link>http://snippets.dzone.com/posts/show/152</link>
      <description>This snippet will quickly uniq an unsorted array; in other words, remove duplicates.   (note: for large arrays, it may be more efficient to sort the array first and simply keep track of consecutive dups instead of using a hash.)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  # Input: @list&lt;br /&gt;  # Output: @uniqed&lt;br /&gt;  my %u = ();&lt;br /&gt;  @uniqed = grep {defined} map {&lt;br /&gt;      if (exists $u{$_}) { undef; } else { $u{$_}=undef;$_; }&lt;br /&gt;    } @list;&lt;br /&gt;  undef %u;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 03:26:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/152</guid>
      <author>jmason (Justin Mason)</author>
    </item>
  </channel>
</rss>
