Untested:
#!/perl/bin/perl use strict; use warnings; use Data::Dumper; use Text::CSV; open my $fh1, "<", "namecleanupapcdevices1.csv" or die $!; open my $fh2, "<", "acs_import.csv" or die $!; my $csv = Text::CSV->new ( { binary => 0 } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); $csv->column_names ( qw| type location1 location2 label model firmware +hostname contact serial ip mac| ); # Set column names for getline_hr () my $firms = $csv->getline_hr_all ($fh1); close $fh1; $csv->column_names ( qw|name64 update64 description subnet support_radius radius_secr +et port support_keywrap keywrap_KEK keywrap_mack keywrap_display support_TACACS tacacsSecret singleconnect leg +acyTACACS Location_String Device_Type_String System_Owner| ); my $row=0; while (my $acs = $csv->getline_hr ($fh2)){ my $firmrow = $firms->[$row++]; # print out info from print $firmrow->{whatever}, $acs->{acs_stuff}; } close $fh2;

        Software efficiency halves every 18 months, thus compensating for Moore's Law.


In reply to Re: Need Help with foreach statement????? by NetWallah
in thread Need Help with foreach statement????? by brawal128

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.