develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #56674] using $1 evaluates strangely in list context when combined with ?:-operator

Thread Next
From:
Jan Schmidt
Date:
July 7, 2008 09:54
Subject:
[perl #56674] using $1 evaluates strangely in list context when combined with ?:-operator
# New Ticket Created by  Jan Schmidt 
# Please include the string:  [perl #56674]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56674 >





This is a bug report for perl from perlbugs@jan-o-sch.net,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------
[Please enter your report here]

Those two should not give different results, I suppose:

$ perl -le 'print join " ", (("a1a"=~/(\d+)/?"$1":$a),("b2b"=~/(\w+)/),);'
1 b2b
$ perl -le 'print join " ", (("a1a"=~/(\d+)/?$1:$a),("b2b"=~/(\w+)/),);'
b2b b2b

(verified on several platforms)

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=core
     severity=medium
---
Site configuration information for perl v5.8.8:

Configured by Gentoo at Tue May 27 19:43:27 CEST 2008.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
   Platform:
     osname=linux, osvers=2.6.22-gentoo-r10, 
archname=i686-linux-thread-multi
     uname='linux jhp 2.6.22-gentoo-r10 #2 smp preempt wed mar 5 
14:05:53 cet 2008 i686 intel(r) core(tm)2 cpu t7200 @ 2.00ghz 
genuineintel gnulinux '
     config_args='-des -Darchname=i686-linux-thread -Dcccdlflags=-fPIC 
-Dccdlflags=-rdynamic -Dcc=i686-pc-linux-gnu-gcc -Dprefix=/usr 
-Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth=  -Doptimize=-O2 -g 
-march=pentium-m -pipe -fomit-frame-pointer -msse3 -msse2 -msse -mmmx 
-mfpmath=sse -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin 
-Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 
-Dinstallman1dir=/usr/share/man/man1 
-Dinstallman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm 
-Dinc_version_list=5.8.0 5.8.0/i686-linux-thread-multi 5.8.2 
5.8.2/i686-linux-thread-multi 5.8.4 5.8.4/i686-linux-thread-multi 5.8.5 
5.8.5/i686-linux-thread-multi 5.8.6 5.8.6/i686-linux-thread-multi 5.8.7 
5.8.7/i686-linux-thread-multi  -Dcf_by=Gentoo -Ud_csh -Dusenm 
-Dusethreads -Di_ndbm -Di_gdbm -Ui_db'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='i686-pc-linux-gnu-gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE 
-DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe 
-Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
     optimize='-O2 -g -march=pentium-m -pipe -fomit-frame-pointer -msse3 
-msse2 -msse -mmmx -mfpmath=sse',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-statement 
-I/usr/include/gdbm'
     ccversion='', gccversion='4.1.2 (Gentoo 4.1.2 p1.0.2)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='i686-pc-linux-gnu-gcc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.6.1.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.6.1'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
     cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.8:
     /etc/perl
     /usr/lib/perl5/vendor_perl/5.8.8/i686-linux-thread-multi
     /usr/lib/perl5/vendor_perl/5.8.8
     /usr/lib/perl5/vendor_perl
     /usr/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi
     /usr/lib/perl5/site_perl/5.8.8
     /usr/lib/perl5/site_perl
     /usr/lib/perl5/5.8.8/i686-linux-thread-multi
     /usr/lib/perl5/5.8.8
     /usr/local/lib/site_perl
     .

---
Environment for perl v5.8.8:
     HOME=/home/jan
     LANG=en_US
     LANGUAGE (unset)
     LC_ADDRESS=de_DE@euro
     LC_COLLATE=de_DE@euro
     LC_MEASUREMENT=de_DE@euro
     LC_MONETARY=de_DE@euro
     LC_NAME=de_DE@euro
     LC_NUMERIC=de_DE@euro
     LC_PAPER=de_DE@euro
     LC_TELEPHONE=de_DE@euro
     LC_TIME=de_DE@euro
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.1:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/games/bin:/opt/vmware/server/console/bin:/home/jan/scr
     PERL_BADLANG (unset)
     SHELL=/bin/bash


Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About