I have a problem when it comes to comparing the titles in the array if they already exist with the file which contains the description.

Whenever you think "already exist", think "hash". Replace your array with a hash, and look at exists.

I didn't look closer at your code, because it's really long and I'm not interested in wading through long code, where most of the lines have no bearing to the problem. You haven't shown any effort to reduce the problem to the minimal lines necessary. Most likely, the minimal problem would look like:

use strict; #open (CH, "</opt/lampp/htdocs/parser/test/exploit_description.txt"); my @check = <DATA>; #close CH; my @unique_milw0rm = (); my @milw0rm_title; for (my $i;$i<=$#milw0rm_title;$i++) { $seen = 0; for (my $j;$j<=$#check;$j++) { if ($milw0rm_title[$i] =~ /$check[$j]/) { $seen = 1; next; } }; if ($seen == 0) { push @unique_milw0rm, $milw0rm_title[$i]}; }; __DATA__ some milw0rm data more milw0rm data

Then, I would have spotted the two problems in the code right away, and likely you would have too. First, use a hash for the titles to check for the existence. Second, you are reading in the titles with newlines at the end, but likely you're comparing them to other data that doesn't have newlines at the end. Check that by printing the two items:

print "First entry of check array: >$check[0]<\n";

Then, you want to read on chomp.


In reply to Re: Help me please for milw0rm.com downloader by Corion
in thread Help me please for milw0rm.com downloader by matrix_killer

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.