Regarding the "...and form a table" portion of your title: Text::Table. The comparisons were addressed here. If you need further help, please post all of the arrays and their contents—I only see two.
Comment on Re: compare 2 arrays of strings and form a table