http://qs321.pair.com?node_id=912325


in reply to Adding directories to the end of @INC

lib.pm isn't very large or complicated - how about making a copy with a new name (lib::append, maybe?) and replacing the unshift(@INC,...)s with pushes? And perhaps add a couple of reverses if you want duplicate-removal to leave the last instance of a directory instead of the first:

# remove trailing duplicates ## @INC = grep { ++$names{$_} == 1 } @INC; # remove leading duplicates @INC = reverse grep { ++$names{$_} == 1 } reverse @INC;

--

"Any sufficiently analyzed magic is indistinguishable from science" - Agatha Heterodyne