"Using Tie::File module. This module makes a file look like a Perl array,each array element corresponds to a line of the file. Tie::File is very efficient; instead of rewriting the entire file, it just rewrites what is necessary to apply the modification you specify."