I have a csv file that among other data, for this particular problem, contain these fields: 1) employee_name, 2) employee_group, 3) manager_name . For some of the employee_name entries, the group entries are empty (null). So, since the managers are also listed as employees in this file, I would like to be able to do a look up on their entries to copy their group information into the null entries of their corresponding employees, and I don't know how to code this. I'm thinking the pseudo-code might be something like:

if $element->[employee_group] = "" then (go to $element->[manager_name] copy $element->[manager's_group] to $element->[employee_group]);

So, this is an idea of what it might look like.

Sam Malone,Cheers,Rebecca Howe Woody Boyd,,Rebecca Howe Rebecca Howe,Cheers,Rebecca's Manager

You can see that Woody's group info is missing - null. So I'd like the code to go to Woody's manager, Rebecca Howe, and copy her group info to Woody's missing group field to make the file as such:

Sam Malone,Cheers,Rebecca Howe Woody Boyd,Cheers,Rebecca Howe Rebecca Howe,Cheers,Rebecca's Manager

Thanks, Gurus!


In reply to Field data missing; copying from other field by pbassnote

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.