m//i behaves strange : variable does not match itself

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I use unicode and locales (de_AT.UTF-8) and - against warnings of
combing these - everything works fine (finally !!)
I can sort(), lc() and pattermatch but there is one very interesting
problem left with m//i : Characters with multibyte-representation only
match if the pattern is beheaded by something. I would not be suprised
if it never matches, but I am suprised that it only matches "sometimes"
and not even matches itself !!

example: (in german ist the uppercase to )

   =~ m//i          => no match !!
   =~ m/^/i         => match !!
   =~ m/^/i         => match
bc =~ m/b/i         => match
bc =~ m//i          => no match

real source:

use locale;
print $s=~/$s/i?"ok\n":"fail\n"

==> fail !!!

There is an easy workaround this, by calling lc() to the searchterm and
the pattern first and use m// without the i-flag then, but its an
interesting behaviour.

As I could see till now this phenomen does not depend on the special
locale used (de_AT.UTF-8, en_US, C ....) but occures as soon "use local"
is invoked.



Site Timeline