in reply to remove non ascii characters in a whole corpus
There are several ways to approach that. Here are a couple of the easiest:
- opendir will let you read the list of files in the source directory. You could then use a foreach loop to open each of them in turn, read the contents, do your transformation, open a corresponding file in the output directory, and write your transformed content to it.
- You could also just use a pattern glob, perhaps something like this:
This is slightly less portable (because the syntax of your glob is platform-dependent), and less flexible (because the glob is hardcoded, so it's harder to do things like read the source directory path from a config file), but for a quick-and-dirty hack, it's easier to get working quickly.foreach my $file (</path/to/sourcedir/*>) { # ... }
HTH.HAND.
|
---|
In Section
Seekers of Perl Wisdom