in reply to
Removing files from remote server
I would recommend debugging your script by first printing the ssh statement instead of putting it in backticks. This way you can verify what will be sent and once you are satisfied with that, you can put it in backticks. You will note that you are sending a bad command to the other server. You will also then figure out why you are getting a "could not resolve hostname" error.
There are a couple of issues with your files_DEL subroutine. my @LIB_FILES = shift
is not going to do what you want. Remove that line and use @_ instead of @LIB_FILES. Running system
inside your subroutine will run that command on your local computer. What you really intend to do is return a string like " && rm -fr lib1 && rm -fr lib2" to the caller which in turn will append it to the ssh command.