(10 points, max.perl) Write a Perl function named find_max that:
For example, given the two arrays:
- 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 with B,
compare A with B, 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.
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
- reads the two arrays from the command line. The words in the two arrays will be
separated by a #.
perl max.perl cat fred smiley ebber # joe dog
- calls your find_max function, and
- prints the result. For example:
joe fred smiley ebber