Here's the code with some fixed typos and with error checking.
#!/usr/bin/perl -w use strict; use Text::CSV_XS qw( ); @ARGV == 1 or die("usage: $0 id\n"); my ($query_id) = @ARGV; my $csv = Text::CSV_XS->new(); my $query_cve_id; { my $map_qfn = 'vuln_cve_map.csv'; open(my $map_fh, '<', $map_qfn) or die("Can't open mapping file \"$map_qfn\": $!\n"); while (my $row = $csv->getline($map_fh)) { my ($id, $cve_id) = @$row; if ($id == $query_id) { $query_cve_id = $cve_id; last; } } if ($csv->error_diag()) { die("Can't parse mapping file: ", $csv->error_diag(), "\n"); } } { my $summary_qfn = 'CVE_summary.csv'; open(my $summary_fh, '<', $summary_qfn) or die("Can't open CVE Summary file \"$summary_qfn\": $!\n"); while (my $row = $csv->getline($summary_fh)) { my ($cve_id, $summary) = @$row; if ($cve_id == $query_cve_id) { print("[$cve_id] $summary\n"); last; } } if ($csv->error_diag()) { die("Can't parse CVE Summary file: ", $csv->error_diag(), "\n"); } }

Running it yields

Can't parse CVE Summary file: 2021EIQ - NL char inside quotes, binary +off58

Your data is bad.

"CVE-1999-0095","The debug command in Sendmail is enabled ^ | missing closing quote

In reply to Re^5: Real basic... by ikegami
in thread Real basic... by spstansbury

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.