<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: union code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 09:58:09 GMT</pubDate>
    <description>DZone Snippets: union code</description>
    <item>
      <title>Perl: Sorted union of two arrays</title>
      <link>http://snippets.dzone.com/posts/show/3056</link>
      <description>Create a union of two arrays and sort the array.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;my @union = array_union_sort(\@first, \@second);&lt;br /&gt;&lt;br /&gt;sub array_union_sort {&lt;br /&gt;    my $aa = shift;&lt;br /&gt;    my $bb = shift;&lt;br /&gt;    my %union;&lt;br /&gt;    my $e;&lt;br /&gt;    foreach $e (@$aa) { $union{$e} = 1; }&lt;br /&gt;    foreach $e (@$bb) { $union{$e} = 1; }&lt;br /&gt;    my @union = keys %union;&lt;br /&gt;    @union = sort { $a &lt;=&gt; $b } @union;&lt;br /&gt;    return @union;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 29 Nov 2006 12:45:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3056</guid>
      <author>nilesh (Nilesh)</author>
    </item>
  </channel>
</rss>
