vihnny has asked for the wisdom of the Perl Monks concerning the following question:
Hello PERL MONKS...
I gotta a question for you. If I had inputs entered by the user and I want to display them back but separately, how would I do it?
HERE IS AN EXAMPLE
The user enter these numbers: (1200, 1300, 1200, 1000, 1100, 1200, 1500, 1700, 2000, 2100, 3000, 2100, 1200, 1500, 1700, 1700) So I insert them in the array @input;
now I want to separate its elements if they are duplicate and create new arrays and put these items in there. For each element duplicated I create a new array and place that element in there. Example:
group one (1200, 1300, 1000, 1100, 1500, 1700, 2000, 2100, 3000)
group two (1200, 2100)
group three (1200, 1500, 1700)
group four (1200, 1700)
How can I code this?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Duplicate Element in an Array
by johngg (Canon) on Aug 21, 2012 at 23:56 UTC | |
Re: Duplicate Element in an Array
by choroba (Cardinal) on Aug 21, 2012 at 21:17 UTC | |
Re: Duplicate Element in an Array
by nemesdani (Friar) on Aug 21, 2012 at 21:02 UTC |