Alright then,
first you want to think about how you are going to populate the arrays. For example, 
if I have a file that contains the following data:
1|10
5|7

I would do this:

open(FH, "< bob.txt");

my @file_list;

while(<FH>)
{
        # add a reference of the 2 file columns to @file_list
        push(@file_list, [split(/\|/, $_)]);
}

-------------------

Doing the same thing with a database is a more contentious issue as there are many 
different ways to go about it, but I would do the following:

my $dbh = DBI->connect(); # however you want to connect to the database

my $sth = $dbh->prepare('SOME SQL HERE');
$sth->execute; # run the sql

my @db_list;

while($sth->fetchrow_arrayref)
{
        # assuming you only select 2 rows in your sql
        push(@db_list, $_);
}

----------------

So now we have 2 arrays of array references we need to compare them. Ofcourse, it 
would be much more efficient to do this within the second loop but for the sake of 
simplicity we'll do this in another loop again:

foreach(@file_list)
{
        my $file_start = $_->[0];
        my $file_end = $_->[1];

        foreach(@db_list)
        {
                my $db_start = $_->[0];
                my $db_end = $_->[1];

                # check to see whether the 2 numbers taken from the
                # file exist between the 2 numbers taken from the
                # database, this might not be what you want but you
                # get the idea, right?
                if(($file_start >= $db_start) &&
                        ($file_end <= $db_end))
                {
                        # do whatever you want to do with
                        # your matches here
                }
        }
}

Hope this send you along the right path, if not and you've read this far then I can 
only apologise.

Cheers!

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to