(10 points, max.perl) Write a Perl function named find_max that:
- takes two arrays, e.g. array A and array B, as parameters
- compares each pair of elements from the two arrays, e.g. compare A[0] with B[0],
compare A[1] with B[1], etc.
- returns one array containing the maximum element from each comparison. If one array
is larger than the other array, then the excess elements from the longer array are
the default maximum elements.
For example, given the two arrays:
array 1: (cat, fred, smiley, ebber)
array 2: (joe, dog)
your function should return the array:
(joe, fred, smiley, ebber)
After you write your find_max function, place code into your file
that:
- reads the two arrays from the command line. The words in the two arrays will be
separated by a #.
For example:
perl max.perl cat fred smiley ebber # joe dog
- calls your find_max function, and
- prints the result. For example:
joe fred smiley ebber