josephjohn,
Unfortunately, you haven't given enough information to give a working solution. See this for an example of well defined requirements and assumptions. Here are some ideas though.

Instead of slurping the first file into an array, you should consider a hash instead. This will improve your search time and also will get rid of your terribly inefficient way of removing the record from the array (see splice as an alternative to your method) by using delete. Additionally, using a hash will give meaningful names to columns. If you are forced to use an array, consider the constant pragma to make the indices more meaningful.

Cheers - L~R

Update: Here is a proof of concept

use constant COMP => 0; use constant USER => 1; use constant UNKN => 2; my %inventory; open(my $fh_inv, '<', 'Inventory.csv') or die "Unable to open 'Invento +ry.csv' for reading: $!"; while ( <$fh_inv> ) { chomp; my ($key, $company, $user, $unkn) = (split /,/)[0, 3, 1, 4]; $inventory{$key} = [$company, $user, $unkn]; } my @Data; open(my $fh_clients, '<', 'clients.txt') or die "Unable to open 'clien +ts.txt' for reading: $!"; while ( <$fh_clients> ) { chomp; my @field = split /,/; my $iref = $inventory{$field[3]}; if ( @$iref ) { push @Data, (join ',', $field[3], $iref->[COMP], @field[6,7,4, +11], @{$iref}[USER, UNKN]); } } #processing @Data after this
You should also consider using Text::CSV_XS

In reply to Re: Data parsing - takes too long by Limbic~Region
in thread Data parsing - takes too long by josephjohn

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.