#!/usr/bin/perl -w #use strict; open(FILE2, "; #saving filehandle to array pop @array2; #getting rid of 0 at end %hash2 = @hash2{@array2}; #storing contents of testfile2 without 0 to #a hash open(FILE1, "; #saving filehandle to array pop @array1; #getting rid of 0 at end foreach $number (keys %hash2) { #go through each of the hashs' keys #and assign them to $number for duration of loop some keys might be #used more than once if ($number eq search(@array1)) {#check to see if string $number #equals each iteration of subroutine search being passed values of #@array1. Would have used another foreach loop here, but parentheses #and curly brace placement won't allow it. $hash2{number} += 1; } } sub search { #subroutine search gets one element of @array1 at a #time and returns it. Then moves on to the next value in that array. foreach (@_) {} return $_; } #Ideally here would like to print the array followed by the hash #elements print (@array, %hash2);