Here’s the scenario: you have two lists of integers, and you have a sum. Write an algorithm – in Perl,…