Replace system() by native perl calls