# ... open my $in, "<", "uuu.txt" or die "cannot open the input file$!"; open my $out, ">", "out.txt" or die "cannot open the output file$!"; while (my $line = <$in>) { $line =~s/[\s\d]//g; print $out "$line\n"; } close $_ for ($in, $out); # ... renaming, etc. #### perl -i.bak -p -e 's/[0-9\s]//g' uuu.txt