Sometimes a failed update (due to an unexpected power outage or similar) on Arch Linux may lead to a botched package that is difficult to reinstall due to errors of this type:
perl: /usr/bin/core_perl/corelist exists in filesystem
perl: /usr/bin/core_perl/cpan exists in filesystem
Since pacman no longer has a force option, here is how to fix this:
-
Trying to update the affected package will list all conflicting files - save them to a file:
sudo pacman -S perl 2>perl-errors.txt -
Extract the filenames:
awk '{print $2}' perl-errors.txt > perl-filelist.txt -
Delete the conflicting files:
for f in $(cat perl-filelist.txt) ; do sudo rm "$f" ; done
You can now reinstall the package.