spstansbury has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be greatly appreciated! Best regards, Scott...#!/usr/bin/perl use strict; use warnings; open (DATA, "found_vulns_test"); open (CVE_ID, "CVE_data_Demo"); my @cve_list = <CVE_ID>; while (<DATA>) { chomp; my @list = split/,/; my $vuln = $list[1]; my @matched = (grep (/$vuln/, @cve_list)); # works up to here - grep outputs a string, right? But when I get to t +he next line, I get the scalar/count output... my @matched_cve = split(',', @matched); # Then I want to go through the fields as in the snippet below: $_= $matched_cve[1]; if( /COMPLETE|[C]/i ) { $biasedConf= 100; # percentage Confidentiality Impact v +alues } elsif( /PARTIAL|[P]/i ) { $biasedConf= 50; # percentage Confidentiality Impact va +lues } elsif( /NONE|[I]/i ) { $biasedConf= 0; # percentage Confidentiality Impact + values } else { $biasedConf= 0; # percentage Confidentiality Impact + values }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with grep
by citromatik (Curate) on Jan 30, 2009 at 14:11 UTC | |
|
Re: Problems with grep
by johngg (Canon) on Jan 30, 2009 at 15:14 UTC | |
|
Re: Problems with grep
by Anonymous Monk on Jan 30, 2009 at 14:16 UTC | |
by citromatik (Curate) on Jan 30, 2009 at 14:36 UTC | |
by Anonymous Monk on Jan 30, 2009 at 14:58 UTC | |
by citromatik (Curate) on Jan 30, 2009 at 15:11 UTC | |
by ikegami (Patriarch) on Jan 30, 2009 at 15:31 UTC | |
by spstansbury (Monk) on Jan 30, 2009 at 14:59 UTC | |
by locked_user sundialsvc4 (Abbot) on Jan 30, 2009 at 16:44 UTC |