use strict; use XML::Simple qw(:strict); use LWP::UserAgent; use Data::Dumper; use POSIX qw(strftime); getNVD(); sub getNVD { my $ua = LWP::UserAgent->new; $ua->agent( "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3" ); my $req = HTTP::Request->new( GET => 'http://nvd.nist.gov/download/nvdcve-recent.xml' ); $req->content_type('application/x-www-form-urlencoded'); my $res = $ua->request($req); my $fetch; if ( $res->is_success ) { $fetch = $res->content; } else { print $res->status_line; } my $today = strftime( "%Y-%m-%d", localtime ); my $yesterday = strftime( "%Y-%m-%d", localtime( time - 86400 ) ); my $xml = new XML::Simple; my $data = $xml->XMLin( "$fetch", KeyAttr => { cve => 'entry' }, ForceArray => [ 'cve', 'ref' ] ); my $e; foreach $e ( @{ $data->{entry} } ) { if ( $e->{severity} =~ /High/ && $e->{modified} =~ /($today|$yesterday)/ ) { print $e->{name}; } } #print Data::Dumper->Dump([\$data]); } #### Use of uninitialized value in pattern match (m//) at test.pl line 45. #### if ( $e->{severity} =~ /High/ && $e->{modified} =~ /($today|$yesterday)/ ) {