doonyakka has asked for the wisdom of the Perl Monks concerning the following question:
What am I doing wrong? I've downloaded the locale specifications and have tried es_ES, fr_FR etc, but still no luck. Excuse me if I've made a really elementary goof, but it's all been trial and error so far. Thanks, this seems like a great place to learn and share wisdom!#!/usr/bin/perl use locale; use POSIX(locale_h); # query and save the old locale $old_locale = setlocale(LC_CTYPE); # set locale (doesn't work) setlocale(LC_CTYPE, "ISO8859"); print "Input word: "; $word = <STDIN>; chomp($word); ... $fileNo = 1; # HTML filenames have already been converted to numbers ( +eg., 1.html etc) while ($fileNo <= 610) { open FH, "K:\\$fileNo.html" or die "Can't open: $!"; open OUT, ">>K:\\sentences.txt"; # print OUT "$fileNo.html\n"; # print "$fileNo.html\n"; $/ = "."; while (<FH>) { ... # if (/(^|\. ])([a-z0-9\,\:\;\"\' ]* $word[a-z0-9\,\:\;\"\'\. ] +*)$/i) { # this one doesn't work! if (/(^|\. ])([a-záéíóúñü0-9\,\:\;\"\' ]* $word[a-záéíóúñü0-9\ +,\:\;\"\'\. ]*)$/i) { # so I've had to do this instead! print OUT "\n$fileNo.html: $2\n"; print "\n$fileNo.html: $2\n"; } } close OUT; close FH; $fileNo++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problems with locale
by chromatic (Archbishop) on Jul 09, 2001 at 02:12 UTC | |
|
Re: problems with locale
by wog (Curate) on Jul 09, 2001 at 02:12 UTC |