@dups = @{ { map { $_, $_ } @list_a } }{ @list_b } # Broken out. # Duplicate each key - the key must also be the value since it will be retrieved later. This creates a list useable as a hash. map { $_, $_ } @list_a # Create an anonymous hash from that list { ... } # Fetch a slice from a hash ref using @list_b @{ ... }{ @list_b } # Into dups @dups = ...