Assuming your data is valid, please consider:

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my @f1 = split /\n/, <<'END'; 2010-nhw-es-ea-285, 2012-10-10 aab.external.audit.-.bvr.verif.externes, 2012-02-22 aashee.aziz, 2012-01-27 abbas.rangwala, 2012-01-27 abbie.gardner, 2012-09-10 ab.border-frontiere, 2012-08-11 abdool.yasseen, 2012-01-31 abdullah.aboukarr, 2012-08-10 abdullahi.sheikh, 2012-02-28 END my @f2 = split /\n/, <<'END'; aaron.northway, CHIEF FINANCIAL OFFICER BRANCH aashee.aziz, HEALTH PRODUCTS AND FOOD BRANCH abbey.klugerman, HEALTHY ENVIRONMENTS AND CONSUMER SAFETY BRANCH abby.hoffman, STRATEGIC POLICY BRANCH abderrahim.boussanni, CHIEF FINANCIAL OFFICER BRANCH abdiaziz.nur, HEALTHY ENVIRONMENTS AND CONSUMER SAFETY BRANCH abdool.yassin, HEALTH PRODUCTS AND FOOD BRANCH abdoulie.manjang, N/A abdullah.hassen, HEALTH PRODUCTS AND FOOD BRANCH abdullah.patel, REGIONS AND PROGRAMS BRANCH END my (%f1, %f2); for(@f1) {my ($username, $date) = split /,\s*/; $f1{$username} = $date; } for(@f2) {my ($fullname, $branch) = split /,\s*/; $f2{$fullname} = $branch; } my %names = map {($_, 1)} (keys %f1, keys %f2); say "$_, ", ($f1{$_}//'undefined'), ", ", ($f2{$_}//'undefined') for s +ort keys %names;

Produces:

2010-nhw-es-ea-285, 2012-10-10, undefined aab.external.audit.-.bvr.verif.externes, 2012-02-22, undefined aaron.northway, undefined, CHIEF FINANCIAL OFFICER BRANCH aashee.aziz, 2012-01-27, HEALTH PRODUCTS AND FOOD BRANCH ab.border-frontiere, 2012-08-11, undefined abbas.rangwala, 2012-01-27, undefined abbey.klugerman, undefined, HEALTHY ENVIRONMENTS AND CONSUMER SAFETY B +RANCH abbie.gardner, 2012-09-10, undefined abby.hoffman, undefined, STRATEGIC POLICY BRANCH abderrahim.boussanni, undefined, CHIEF FINANCIAL OFFICER BRANCH abdiaziz.nur, undefined, HEALTHY ENVIRONMENTS AND CONSUMER SAFETY BRAN +CH abdool.yasseen, 2012-01-31, undefined abdool.yassin, undefined, HEALTH PRODUCTS AND FOOD BRANCH abdoulie.manjang, undefined, N/A abdullah.aboukarr, 2012-08-10, undefined abdullah.hassen, undefined, HEALTH PRODUCTS AND FOOD BRANCH abdullah.patel, undefined, REGIONS AND PROGRAMS BRANCH abdullahi.sheikh, 2012-02-28, undefined

In reply to Re: Merging Two CSV files Based on Two Columns by philiprbrenan
in thread Merging Two CSV files Based on Two Columns by TheCanadian

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.