The function setpwent only reads /etc/passwd from the end to the begin (or /etc/shadow if the script is run by root). If you want to set the passwords (in a shadowed environment), you should use Passwd::Linux
if the unix is linux.
Comment on Re: resetting a password entry with setpwent?