F
fmassion
My test file:
höheneinstellbar 1234
bedienbar 5678
1111 Müller
größer 8765
My script:
#!/usr/bin/perl -w
use locale;
open(FILE,'test.txt') ;
@sentence = <FILE>;
foreach $sentence (@sentence) {
chomp $sentence;
if ($sentence =~ m/(\w+)(\s)(\d+)/gx) {
print "$1\n";
}}
Instead of "use locale" I have also tried unsucessfully:
(1)
use utf8;
(2)
use POSIX qw(locale_h);
(3)
use POSIX qw(locale_h);
my $locale = setlocale(LC_ALL, "de_DE");
Result (words broken at German special characters):
heneinstellbar (instead of the expected "höheneinstellbar")
bedienbar
ßer (instead of the expected "größer")
The script works with [\wöäüßÄÖÜ] instead of \w but I assume there is a better solution.
höheneinstellbar 1234
bedienbar 5678
1111 Müller
größer 8765
My script:
#!/usr/bin/perl -w
use locale;
open(FILE,'test.txt') ;
@sentence = <FILE>;
foreach $sentence (@sentence) {
chomp $sentence;
if ($sentence =~ m/(\w+)(\s)(\d+)/gx) {
print "$1\n";
}}
Instead of "use locale" I have also tried unsucessfully:
(1)
use utf8;
(2)
use POSIX qw(locale_h);
(3)
use POSIX qw(locale_h);
my $locale = setlocale(LC_ALL, "de_DE");
Result (words broken at German special characters):
heneinstellbar (instead of the expected "höheneinstellbar")
bedienbar
ßer (instead of the expected "größer")
The script works with [\wöäüßÄÖÜ] instead of \w but I assume there is a better solution.