in reply to Text file (Passwd file) record editing

This is a perlfaq, found in perlfaq5, specifically How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file?

Any good distribution of Perl will come with copious amounts of documentation installed. From a command line, simply type "perldoc perlfaq" to start reading the FAQ.

With that in mind, your problem can be broken down into several steps:

There are also modules which can make this easier for you, such as Text::CSV. ©