diff options
author | Karl Berry <karl@freefriends.org> | 2016-07-03 23:33:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-07-03 23:33:11 +0000 |
commit | 3c037f860bdc9125229af4a8a464dbc699f11826 (patch) | |
tree | 6e36d362b1999557405cfb8ce993506894d682a7 /Master/tlpkg/TeXLive | |
parent | 615d20e9e7e3419b60da93dd48f56aa45d7899ac (diff) |
(push_uniq): use my with $reference, instead of local.
git-svn-id: svn://tug.org/texlive/trunk@41618 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index fa4d1abbf5e..75027dfdd23 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -2961,28 +2961,26 @@ sub sort_uniq { } -=item C<push_uniq(\@list, @items)> +=item C<push_uniq(\@list, @new_items)> -The C<push_uniq> function pushes the last elements on the list referenced -by the first argument. +The C<push_uniq> function pushes the last argument @ITEMS to the $LIST +referenced by the first argument, if they are not already in the list. =cut sub push_uniq { - # can't we use $l as a reference, and then use my? later ... - local (*l, @le) = @_; - foreach my $e (@le) { - if (! &member($e, @l)) { - push @l, $e; + my ($l, @new_items) = @_; + for my $e (@new_items) { + if (! &member($e, @$l)) { + push (@$l, $e); } } } - =item C<member($item, @list)> -The C<member> function returns true if the the first argument is contained -in the list of the remaining arguments. +The C<member> function returns true if the first argument +is also inclued in the list of the remaining arguments. =cut |