Well it seems to me that you do have a working solution and to add to the other answers you got:
(I don't like backticks, be it in Perl or shell!)MYPATH=$(perl -e'print join":",grep!$s{$_}++,split/:/,$ENV{MYPATH}')
MYPATH=$(echo $MYPATH|perl -F: -lape'$_=join":",grep!$s{$_}++,@F')
However be warned: I'm now more playing golf than answering your actual question...
In reply to Re: Perl one-liner to remove duplicate entries from PATH
by blazar
in thread Perl one-liner to remove duplicate entries from PATH
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |