Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am able to use either of the lines here to clean a single file of non ascii characters. I also have a program that will loop through a whole corpus of files, but when I use one of the lines below to clean them, the new files created are missing most of the text if not all. I can see that the program is working. Why will these lines work with a single file but not with a whole folder of files?
$line=~ s/[^!-~\s]//g;
internal brackets do not seem to show up when I post
$line =~s/[^[:ascii:]]//g;
internal brackets do not seem to show up when I post
Also Perl seems to dislike the use of !. It says void context: $line !~s/[^[:ascii:]]//g;
Code tags added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: clean corpus of ascii not a file
by GrandFather (Saint) on Oct 29, 2014 at 22:17 UTC | |
|
Re: clean corpus of ascii not a file
by AnomalousMonk (Archbishop) on Oct 30, 2014 at 00:23 UTC |