ucanflyit has asked for the wisdom of the Perl Monks concerning the following question:
Are there similar commands in Perl to uniquely sort an array, produce a new array and count how many times an entry appears in the original?
All I've found is a standard sort.
Parts of Korn Shell script:@modlist2 = sort (@modlist);
sort -u modtype_2430.srt > modtype_2430.unq for k in `cat modtype_2430.unq` do if [ "$k" != 0 ] then type=$(grep $k modtype_2430.srt|wc -l)
Edit by tye, add formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting arrays
by davido (Cardinal) on May 28, 2004 at 15:41 UTC | |
|
Re: sorting arrays
by eric256 (Parson) on May 28, 2004 at 15:52 UTC | |
|
Re: sorting arrays
by sgifford (Prior) on May 28, 2004 at 16:06 UTC | |
|
Re: sorting arrays
by Limbic~Region (Chancellor) on May 28, 2004 at 16:25 UTC |