#!/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_secret port support_keywrap keywrap_KEK keywrap_mack keywrap_display support_TACACS tacacsSecret singleconnect legacyTACACS 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;