I have constructed a script which compares four arrays:
First array consists of publication dates of books from reading lists - approx. 2000 values in total
Second array consists of Titles of books from reading lists - approx. 2000 values in total
Third array consists of publication dates of books from catalogue - approx. 83,000 values in total
Fourth array consists of Titles of books from catalogue - approx. 83,000 values in total

The purpose of the script is to compare the values of 2000 book-titles & 2000 publication-dates with 83,000 book-titles and 83,000 publication dates. If publication-dates and book-titles match then it is printed on the screen. Ultimately, I am trying to find which books contained in reading list are contained in the catalogue as well.
---
here is my script:
----
my @readingbooks = ("a b", "c d", "e f", "g h");
my @readingdate = (1991, 1992, 1993, 1994);
my @catbooks = ("one", "two", "three", "client's", "five", "six", "seven", "eight", "a b");
my @catdate = (1980, 1981, 1982, 1994, 1984, 1985, 1986, 1987, 1991);

my $rdbooks; my $rddate; my $cataloguebooks; my $cataloguedate;

for (0..$#readingbooks){

$rdbooks = $readingbooks$_;
$rddate = $readingdate$_;

for (0..$#catbooks){

$cataloguebooks = $catbooks$_;
$cataloguedate = $catdate$_;

if (($rdbooks eq $cataloguebooks) && ($rddate == $cataloguedate)) {
print "$rdbooks \t $cataloguebooks \n";
print "$rddate \t $cataloguedate \n";
print "wow \n\n";

}
}
}

The problem in when I run a small set of data this script works fine, but when I actually run it with the complete data of 2000 to compare with 83,000 then it doesn't work. Can anyone please help what am I doing wrong here, or what process i need to adopt for making it work?

thanks in advance for your time and help!
--
Vani


In reply to How to work with Arrays of 83,000 values by vaniaul

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.