I have this code:
opendir(DIR, ".");
while (readdir DIR) {
print $1, "\n" if $_ =~ /(\w+)/i;
}
It gets only ASCII strings of course. How can I get another non ASCII strings in output with using regexp?
UPD
For example if in “.” directory there are two files file and другойфайл. So when I run this script I get only file in the output but I’d like to get another file with non English name другойфайл
The following code seems to work:
This assumes your file system stores names in UTF-8, of course.
Output: