in reply to Changing user in perl script

I agree with tirwhan that sudo is the tool for the job. If you must do user authentication in a script use Term::ReadKey to stop the password being echoed to the screen.

use Term::ReadKey; ... print "Password? "; ReadMode 'noecho'; $password = ReadLine 0; ReadMode 'normal'; ...

Cheers,

JohnGG