this is my first post in this forum. So I may ask something that is in the FAQs or has been posted already a thousand times. But I'm a bit rushed because I have to accomplish a task with Perl right now. I have searched my available ressources (i.e. Perl's own POD, FAQ, the "Perl Cook Book" other ORA Books, posting in a German Perl forum). I would consider myself rather a Perl rookie, but I post here in the advanced section because I hope to find the gurus here.

My task at hand is quite simple to describe. Let me give you two lines of a similar example:

Now I would like, for instance, to find all the indices of array @a which hold values from array @b.

To me this seems to call for some Schwartzian transform to do it most effeciently through some cleverly linked greps and maps. I think one would have to construct some interim anonymous array ref like "map { [$idx++, $_ ] } @a" to grep with through the values of @b, and map the result again into a new list. But I cannot find the trick. Of course, I could do it in ordinary foreach loops, but this doesn't seem to be very efficient.

you really are a Perl guru because your solution is concise and elegant. I feared to have to involve some CPAN Set::* module. But then, as you may have seen from my question, I'm mathematically not very skilled (especially when it comes to sets ;-)

That I haven't realized the hash trick myself :-(

As you can see from below, I had to device the hash trick a second time to strip possible multiple occurences from the result set. Btw, is this in mathematical lingo an intersection, or how is it called?