Dear Monks,
Im using the below code to remove repeated lines in my file.
sub remove_repeated(){ my %seen(); local @ARGV = ($file_name); local $^I = ".bak"; while(<>){ %seen {$_}++; next if $seen{$_}>1; print; } }
The problem is that if my input file has 2 lines with just a difference of a white space at the beginning or end, then those 2 lines are considered unique by the above code. How to change it so as to neglect white space characters?
In reply to remove repeated lines with space differences by joeperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |