in reply to Building data structure from several /etc/passwd files

See Perl's getpwent, setpwent, endpwent. They know how to manage shadowed passwords, etc. You don't need to manage the /etc/passwd file at all with those perl functions.

After Compline,
Zaxo