Perl function to find the longest word from each separate array

I have a task:

There are several arrays, each element of which is a word. Create a function which finds the longest word from each given array and returns the result as a list. References to arrays should be passed as arguments to the function.

This function gives me the longest word from two arrays. I just didn't get it how to make it find the longest words from each separate array.

If you want to do this for many arrays, just add an additional outer loop:

best_array ← ()
for each array in array_of_array
best ← worst possible value
for each value in array
if value is better than best
then best ← value
end if
end for each
best_array ← best_array, best
end for each