Hi Monks, I'm stumped on an issue that shouldn't be very complex, but I'm having a difficult time coming up with a solution

I build an array of hashes that reads thru a global holiday calendar and populates it with only US & CA holiday dates. Once i have the array of hashes populated I want to remove any holiday dates they both share. For example, they both share 20121225 as xmas holiday. In this case i would like it removed from the array of hashes.

#!/usr/bin/env perl use warnings; use strict; my %countries; my %seen; my @dup; my @countries; my $holiday; my @cntry_of_issue = ('US','CA'); while (<DATA>) { chomp; next if /^\s*$/ || /^\#/; my $aref = [split /,/, $_]; push( @{$countries{$aref->[2]}}, $aref->[5]); } sub strip_US_CA_dup_hols { for (@cntry_of_issue) { foreach $holiday (@{$countries{$_}}) { $seen{$holiday}++; } }#end of for while ( my ($key, $value) = each %seen ) { push @dup,$key if $value > 1; } for (@cntry_of_issue) { delete $@{$countries{$_}} if grep /@{$countries{$_}}/, @dup; } }#end of function &strip_US_CA_dup_hols; __DATA__ 808,XNYS,US,New York Stock Exchange,2012,20120102,Mon,New Year's Day O +BS,T 808,XNYS,US,New York Stock Exchange,2012,20120116,Mon,Martin Luther Ki +ng Jr. Day,T 808,XNYS,US,New York Stock Exchange,2012,20120220,Mon,Presidents' Day, +T 808,XNYS,US,New York Stock Exchange,2012,20120406,Fri,Good Friday,T 808,XNYS,US,New York Stock Exchange,2012,20120528,Mon,Memorial Day,T 808,XNYS,US,New York Stock Exchange,2012,20120704,Wed,Independence Day +,T 808,XNYS,US,New York Stock Exchange,2012,20120903,Mon,Labor Day,T 808,XNYS,US,New York Stock Exchange,2012,20121122,Thu,Thanksgiving,T 808,XNYS,US,New York Stock Exchange,2012,20121225,Tue,Christmas,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120102,Mon,New Year's Day OB +S,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120220,Mon,Family Day,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120406,Fri,Good Friday,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120521,Mon,Victoria/Patriots +' Day,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120702,Mon,Canada Day OBS,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120806,Mon,Civic Holiday,T 665,XTSE,CA,Toronto Stock Exchange,2012,20120903,Mon,Labour Day,T 665,XTSE,CA,Toronto Stock Exchange,2012,20121008,Mon,Thanksgiving,T 665,XTSE,CA,Toronto Stock Exchange,2012,20121225,Tue,Christmas,T 665,XTSE,CA,Toronto Stock Exchange,2012,20121226,Wed,Boxing Day,T

I sent and earlier post that was not correct by mistake. This one is actually legible. Any help would be greatly appreciated. Thanks


In reply to Delete Duplicate CA & US holidays by dirtdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.