in reply to Perl Script to edit the contents of a txt file

Perl Script to edit the contents of a txt file
The question looks like the author wants a text editor written in Perl. There are many choices, from simple exec(ENV{EDITOR},@ARGV) if defined $ENV{EDITOR}; to Text::Editor::Easy or even Padre.

Or did Amarendu mean something else?

Sorry if my advice was wrong.