in reply to Efficiency of seek

As my file is fairly large, does the time consumption of perl's seek is related with file size, or it's a constant time operation? Is it a costly operation?
That depends. How's your file stored? Is it stored on a disk, or is it a tape? If the former, you're likely not to notice, and seek time will not be strongly dependent on file size, or seek distance, although exact details depend on how a file is stored (is the page seeked to already in the file buffer, are we using striping/mirroring, does the physical device spin or not, etc) However, on a tape, seek time will be roughly linear with seek distance.

Note that bulk of the work will be done by the OS, not by Perl.