Closed p5pRT closed 18 years ago
This is a bug report for perl from anno4000@lublin.zrz.tu-berlin.de\, generated with the help of perlbug 1.34 running under perl v5.8.1.
When the each operator is applied to an anonymous hash ref like this
while ( my ( $k\, $v) = each %{ { a => 1} } ) { print "$k $v\n" }
an endless loop results where one key/value pair is repeatedly returned.
In test form:
use Test::More; plan tests => 1;
my $n = 0; while ( each %{ { a => 1 }} ) { ++ $n \< 2 or last; } is $n\, 1\, 'each on anonymous hashref';
Anno
Flags: category=core severity=low
Site configuration information for perl v5.8.1:
Configured by anno4000 at Wed Oct 1 12:15:29 MEST 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=linux\, osvers=2.0.36\, archname=i586-linux uname='linux lublin.zrz.tu-berlin.de 2.0.36 #2 mon jun 26 12:24:02 mest 2000 i586 unknown ' config_args='-des' 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=undef use64bitall=undef uselongdouble=undef usemymalloc=n\, bincompat5005=undef Compiler: cc='cc'\, ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\, optimize='-O2'\, cppflags='-I/usr/local/include' ccversion=''\, gccversion='2.7.2.3'\, 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=4 alignbytes=4\, prototype=define Linker and Libraries: ld='cc'\, ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lposix perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc -lposix libc=/lib/libc-2.0.7.so\, so=so\, useshrplib=false\, libperl=libperl.a gnulibc_version='2.0' 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.1: /opt/home/anno4000/lib/perl /usr/local/lib/perl5/5.8.1/i586-linux /usr/local/lib/perl5/5.8.1 /usr/local/lib/perl5/site_perl/5.8.1/i586-linux /usr/local/lib/perl5/site_perl/5.8.1 /usr/local/lib/perl5/site_perl .
Environment for perl v5.8.1: HOME=/opt/home/anno4000 LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/local/LessTif/Motif1.2/lib LOGDIR (unset) PATH=/opt/home/anno4000/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games PERL5LIB=/opt/home/anno4000/lib/perl PERL_BADLANG (unset) PERL_PRIVLIB=/usr/local/lib/perl5/5.8.1 PERL_SITELIB=/usr/local/lib/perl5/site_perl/5.8.1 SHELL=/bin/tcsh
On Tue\, Aug 02\, 2005 at 02:09:27AM -0700\, Anno Siegel wrote:
When the each operator is applied to an anonymous hash ref like this
while \( my \( $k\, $v\) = each %\{ \{ a => 1\} \} \) \{ print "$k $v\\n" \}
an endless loop results where one key/value pair is repeatedly returned.
I think this is to be expected since it is creating a new hash upon each iteration of the loop.
-- Rick Delaney rick@bort.ca
The RT System itself - Status changed from 'new' to 'open'
[rickdelaney - Tue Aug 02 09:51:45 2005]:
On Tue\, Aug 02\, 2005 at 02:09:27AM -0700\, Anno Siegel wrote:
When the each operator is applied to an anonymous hash ref like this
while \( my \( $k\, $v\) = each %\{ \{ a => 1\} \} \) \{ print "$k $v\\n" \}
an endless loop results where one key/value pair is repeatedly returned.
I think this is to be expected since it is creating a new hash upon each iteration of the loop.
Oh dear\, of course! Withdrawn\, cancelled\, whatever.
Anno
@rgs - Status changed from 'open' to 'rejected'
Migrated from rt.perl.org#36756 (status was 'rejected')
Searchable as RT36756$