Every time I want to install something, mac ports keeps on re-installing Perl, Python, etc. although the same packages are already installed on the system. Is there some setting to avoid this?
What you are seeing there are most probably upgrades for your ports. MacPorts will automatically upgrade all dependencies before installing new ports. Check
port outdated to see a list of available upgrades and
sudo port upgrade outdated to install them.
It is usually recommended to let MacPorts upgrade dependencies before installing new ports to get the latest fixes. However, if you really need to install a port quickly, you can use
sudo port -n install to avoid this behavior and just install the new port only.
It also might be worth your while checking out Homebrew. Unlike MacPorts it tries to work with the unix software that comes with your Mac rather than installing alternative versions.