#!/usr/bin/perl -w #use strict; use CGI ':standard'; my @db = (1, 3, 5, 7, 9, 11); my @in = (1, 2, 5, 8, 9, 10, 13); my $var = 7; # I have this variable available to indicate the length of the array my (%db_lookup, %in_lookup); @db_lookup{@db} = (); @in_lookup{@in} = (); $count = 0; while ($count < $var) { if (exists $in_lookup{$count}, @db) { @db = grep { not exists $in_lookup{$_} } @db; $count += 1; } elsif (not exists $in_lookup{$count}, @db) { push @db, grep { not exists $db_lookup{$_} } @in; $count += 1; } } print "view: @db"; #### my @db = (1, 3, 5, 7, 9, 11); my @in = (21, 22, 25, 28, 29, 210, 213);