Consider this... I didn't write the output of all the fields. I just focused on the fax number and telephone number problem.
#!/usr/bin/perl use strict; use Data::Dumper; use Text::CSV; my $csv = Text::CSV->new(); my %hash_temp; while (my $line = <DATA>) { next if ( $line =~ /^\"create_stamp\"/ ); $csv->parse( $line ); my @cols = $csv->fields(); $hash_temp{"dn: uid="} = lc( $cols[1] ); $hash_temp{"givenName: "} = $cols[2]; $hash_temp{"sn: "} = $cols[3]; $hash_temp{"telephoneNumber: "} = $cols[8] . "-" . $cols[6] if ( $ +cols[7] == 0 ); $hash_temp{"faxNumber: "} = $cols[8] . "-" . $cols[6] if ( $cols[7 +] == 1 ); } print Dumper( \%hash_temp ); __DATA__ "create_stamp","username","first_name","last_name","name","name","exte +nsion","fax_flag","exchange","position","username" "2009-03-02 15:31:52","SimpsonH","Homer","Simpson","Nuclear Control Ce +nter","Radioctive Hall","6798","1","218 555","Nuclear Control Operato +r","BurnsM" "2009-03-02 15:31:52","SimpsonH","Homer","Simpson","Nuclear Control Ce +nter","Radioctive Hall","6793","0","218 555","Nuclear Control Operato +r","BurnsM"

In reply to Re: Manipulating Data by a Field Identifier by bichonfrise74
in thread Manipulating Data by a Field Identifier by rycher

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.