Just can't make this array comparison work



This is programming 101, but darned if I don't keep making arrors that
flummox me (my excuse: I am brand new to Perl). I have two arrays, A
and B. A is vastly larger than B (~30000 elements to B's ~1000) but
some of the elements in A are identical to those in B (~1000 of them
actually). I want to loop thorugh A and throw out everything in the
array so that in the end A=B. The two arrays are sorted. The valuse
being compared are of the form aaaaaaa so that at some point any given
value out of A that is being checked against those in B will be <= to
the remainder of the values (not yet checked) in B.

.