Aggregation is a wonderful thing: ;-)
sub find_unique_items_in { my $set = shift; my (%uniq, @out) = (); for $i (@$s) { $uniq{ $i }++; } push @out, sprintf ( "%d unique entities (%d duplicates):\n", scalar keys %uniq, scalar ( grep { $uniq{$_} > 1 } keys %uniq ), ); for $i (sort keys %uniq) { push @out, sprintf ("%-16s -- %d", $i, $uniq{$i}); } return (join ("\n", @out)); } @list = (0) x 10; for (1..10) { $set = []; push @set_list, $set; for $i (0.. rand(5)+10) { push @$set, \$list[ rand @list ]; } } for $s (@set_list) { print "\n", '-'x72 ,"\n\n"; print join ("\n", @$s), "\n\n"; print &find_unique_items_in ($s), "\n"; }
Not only does it keep your parameter lists trim, it lets you store your data sets so you can use them again.

Now, I don't pretend that the above is an exhaustive search for matching entities, but as far as I know, it's fundamentally impossible to create a parameter list that can't be stored as a data structure. And thinking about those data structures -- especially the possibility of using them again -- helps you build well-organized code.


In reply to Re2: Idea vs realization by mstone
in thread passing arguments by mstone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.