|
Assignment
Write a Perl subroutine named unique that will accept a list as an argument, and return a
list of all the unique items in the original list.
Output of your program:
1, 2, 3, 4, 5, 6
(any order of numbers is fine)
Details
- The special variable $, is the
default record seperator. This is a
set of characters (or none at all) that seperate multiple items written at
the same time. In this case we set it to ', '
- In a subroutine, the value(s) returned is/are the last values
processed or those explicitly returned with the command
return.
- When a list is passed to a subroutine, the list passed is called
@_
inside the subroutine.
Many possible solutions
|