As a general rule, you should avoid changing an array you are iterating over. That's bound to cause all kinds of headaches. Also, it is favourable to name variables by what they mean, not by what they contain. Here, $num is a bad name. $index is better, so are $i, $j, $k, etc.

It is probably worth noting here that $i, $j, $k, $l, and so on are only good loop iteration variables because of the sheer weight of the long-standing convention of using them that way.

As far as I know, this convention originated with the C programming language, although the fact that I, J, K and some others default as integers in FORTRAN suggests that it is older than C. These variables are probably best used when your iteration variables will have integer values, as that is also a (weaker) long-standing convention. In the example that started this discussion, the iteration was over the positions in an array, which are integers in Perl. If you are iterating over the values of an array, as in the solution presented by holli above, you should use a descriptive iterator variable as holli did.

The solution holli presented also illustrates another problem: algorithmic complexity. Nested loops are usually the slowest practical way to solve a problem, and when you see such a construction, you should consider if there is a better way, and explicitly checking two elements of @drop is really just an unrolled nested loop. (See also: Loop unrolling) On modern hardware, the issue will be unnoticeable until you are trying to process large amounts of data, and then your program will suddenly be horrendously slow. For more enlightenment on this, analyze the expected running time of the various solutions here and then run actual benchmarks with both the small data set given in the original assignment and some (much) larger generated data sets, with hundreds, thousands, tens of thousands, hundreds of thousands, and millions of items.

However, in homework tasks for beginners, loop unrolling is less likely in the curriculum, and my guess is that it's all about that bass nested loops. All the other solutions given so far won't work if @drop has more or less that two elements…