sub remove_repeated(){ my %seen(); local @ARGV = ($file_name); local $^I = ".bak"; while(<>){ %seen {$_}++; next if $seen{$_}>1; print; } }