# New Ticket Created by [EMAIL PROTECTED]
# Please include the string: [perl #34247]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34247 >
This is a bug report for perl from [EMAIL PROTECTED],
generated with the help of perlbug 1.35 running under perl v5.8.6.
-----------------------------------------------------------------
[Please enter your report here]
It looks like dynamic scoping of $digit is not working properly when
recursion is used.
Consider:
sub b {
print "B $1\n";
$_[0] =~ /(l+)/;
b("allllocate") if $_[0] eq "hello";
print "E $1\n";
}
b("hello");
This prints
B
B ll
E llll
E llll
while I would expect the last "E" to be "ll".
Dynamic scoping works fine when different block is entered:
sub c {
print "B $1\n";
$_[0] =~ /(l+)/;
print "E $1\n";
}
sub d {
print "B $1\n";
$_[0] =~ /(l+)/;
print "M $1\n";
c("allllocate");
print "E $1\n";
}
d("hello");
This produces
B
M ll
B ll
E llll
E ll
as expected.
This behavior was tested with 5.005_03, 5.6.2, 5.8.6, and 5.9.1.
\Anton.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.8.6:
Configured by tobez at Fri Feb 4 00:51:24 CET 2005.
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
Platform:
osname=freebsd, osvers=5.3-stable, archname=amd64-freebsd
uname='freebsd heechee.tobez.org 5.3-stable freebsd 5.3-stable #7: wed dec
22 11:25:46 cet 2004 [EMAIL PROTECTED]:usrobjusrsrcsystu4a amd64 '
config_args='-sde -Dprefix=/usr/local
-Darchlib=/usr/local/lib/perl5/5.8.6/mach -Dprivlib=/usr/local/lib/perl5/5.8.6
-Dman3dir=/usr/local/lib/perl5/5.8.6/perl/man/man3
-Dman1dir=/usr/local/man/man1
-Dsitearch=/usr/local/lib/perl5/site_perl/5.8.6/mach
-Dsitelib=/usr/local/lib/perl5/site_perl/5.8.6 -Dscriptdir=/usr/local/bin
-Dsiteman3dir=/usr/local/lib/perl5/5.8.6/man/man3
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl
-Dcc=cc -Doptimize=-O -pipe -Duseshrplib
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.6/BSDPAN" -Ud_dosuid -Ui_gdbm
-Dusethreads=n -Dusemymalloc=y -Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=define uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.6/BSDPAN"
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-I/usr/local/include',
optimize='-O -pipe ',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.6/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-Wl,-R/usr/local/lib/perl5/5.8.6/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
SUIDPERLIO0 - fix PERLIO_DEBUG local root exploit (CAN-2005-0155)
SUIDPERLIO1 - fix PERLIO_DEBUG buffer overflow (CAN-2005-0156)
---
@INC for perl v5.8.6:
/usr/local/lib/perl5/site_perl/5.8.6/mach
/usr/local/lib/perl5/site_perl/5.8.6
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.6/BSDPAN
/usr/local/lib/perl5/5.8.6/mach
/usr/local/lib/perl5/5.8.6
.
---
Environment for perl v5.8.6:
HOME=/home/tobez
LANG=ru_RU.KOI8-R
LANGUAGE (unset)
LC_MESSAGES=en_US.ISO8859-15
LC_MONETARY=en_US.ISO8859-15
LC_NUMERIC=en_US.ISO8859-15
LC_TIME=en_US.ISO8859-15
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/tobez/bin:/usr/local/site/bin:/usr/X11R6/bin
PERL_BADLANG (unset)
SHELL=/usr/local/bin/zsh