in reply to Changing file permissions in perl

umask and chmod should do what you want.