I like how the code identifies duplicate PATH directories by using the inode. The system administrators who set up the environment I use at $work have added in a few duplicate directories. In my case, they are not links; so the warning message is a little misleading, but the important thing is that I get some kind of warning.
Currently, the code only filters out the specially-name directories (. and ..). I adapted the code to filter out all directories which are sub-directories of each PATH directory. Also, I filter out all files which do not have execute permissions.
To add these filters, change:
sort grep !/^\.\.?$/,
to:
sort grep {-x "$dir/$_"} grep {! -d "$dir/$_"}