in reply to Detect Duplicated line

If the file exists before your Perl script starts (and you're on *nix), you could uniq - d the file first.