casiano has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

When I compile the following program with perl 5.8.8:

-bash-3.1$ cat -n prueba.pl 1 use strict; 2 use encoding 'utf8'; 3 4 my $x = 'áéíóúñ€'; 5 $x =~ m/áéíóúñ(€)/;
I've got a "segment fault" error:
-bash-3.1$ perl -c prueba.pl Violación de segmento
Is a Fedora Linux machine:
-bash-3.1$ uname -a Linux somename.domain.es 2.6.24.2 #3 SMP Fri Feb 15 10:39:28 WET 2008 +i686 i686 i386 GNU/Linux
This is the gcc compiler:
-bash-3.1$ gcc -v Usando especificaciones internas. Objetivo: i386-redhat-linux Configurado con: ../configure --prefix=/usr --mandir=/usr/share/man -- +infodir=/usr/share/info --enable-shared --enable-threads=posix --enab +le-checking=release --with-system-zlib --enable-__cxa_atexit --disabl +e-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c +,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-ds +si --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2 +.0/jre --with-cpu=generic --host=i386-redhat-linux Modelo de hilos: posix gcc versión 4.1.2 20070626 (Red Hat 4.1.2-13)
This is the locale:
-bash-3.1$ env | grep -i lan LANG=es_ES.UTF-8
I tried the same program in a Linux Debian installation with similar results:
lhp@nereida:~/Lperl/src/testing$ perl encoding3.pl *** glibc detected *** double free or corruption (!prev): 0x08205830 * +** Abortado

Am I doing something wrong? Or is a real bug? May be is already known?

Many thanks

Casiano

Replies are listed 'Best First'.
Re: Perl bug in "encoding" module?
by alexm (Chaplain) on Mar 15, 2008 at 14:45 UTC
Re: Perl bug in "encoding" module?
by ikegami (Patriarch) on Mar 15, 2008 at 20:48 UTC
    I don't know if this will help your current problem any, but there was recently extensive discussion on P5P on how "use encoding '...';" has serious (unrelated) fundamental problems. You're better off using "use utf8;".
      Many thanks!

      Casiano