Skip Menu |
Report information
Id: 1763
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: jhi [at] cc.hut.fi
Cc:
AdminCc:

Operating System: Solaris
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: (no value)
Fixed In: (no value)



From: Jarkko Hietaniemi <jhi [...] cc.hut.fi>
Date: Wed, 10 Nov 1999 15:00:05 +0200 (EET)
To: perlbug [...] perl.com
Subject: another matching finding by pcre author
Download (untitled) / with headers
text/plain 2.3k
----------------------------------------------------------------- [Please enter your report here] One more from PCRE (ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/) author Philip Hazel. If this (rightly) fails to match ./perl -wle '"a" =~ /^(a)?a$/;print $1' Use of uninitialized value at -e line 1. why does this match? ./perl -wle '"a" =~ /^(a)?(?(1)a|b)+$/;print $1' a [Please do not change anything below this line] ----------------------------------------------------------------- --- Site configuration information for perl 5.00562: Configured by jhi at Wed Nov 10 01:04:17 EET 1999. Summary of my perl5 (revision 5.0 version 5 subversion 62) configuration: Platform: osname=solaris, osvers=2.7, archname=sun4-solaris uname='sunos mimosa.hut.fi 5.7 generic_106541-05 sun4u sparc ' config_args='-ders -Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='gcc', optimize='-O', gccversion=2.8.1 cppflags='-DUSE_LARGE_FILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags ='-DUSE_LARGE_FILES -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='gcc', ldflags =' ' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G' Locally applied patches: --- @INC for perl 5.00562: lib /u/vieraat/vieraat/jhi/Perl/lib /opt/lib/perl5/5.00562/sun4-solaris /opt/lib/perl5/5.00562 /opt/lib/site_perl/5.00562/sun4-solaris /opt/lib/site_perl . --- Environment for perl 5.00562: HOME=/u/vieraat/vieraat/jhi LANG=C LANGUAGE (unset) LC_CTYPE=iso_8859_1 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/u/vieraat/vieraat/jhi/.s:/p/bin:/p/adm/bin:/usr/bin:/usr/sbin:/sbin:/bin:/usr/ccs/bin:/usr/lib:/etc:/lib:/p/X6/bin:/usr/bin/X11:/usr/lib/acct:/usr/5bin:/u/vieraat/vieraat/jhi PERLLIB=/u/vieraat/vieraat/jhi/Perl/lib PERL_BADLANG (unset) SHELL=/bin/zsh
To: jhi [...] cc.hut.fi
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19991110.003] another matching finding by pcre author
Date: Wed, 10 Nov 1999 09:07:10 -0600
From: Greg Bacon <gbacon [...] itsc.uah.edu>
Download (untitled) / with headers
text/plain 830b
In message <199911101300.PAA16873@mimosa.hut.fi>, Jarkko Hietaniemi writes: : One more from PCRE (ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/) : author Philip Hazel. If this (rightly) fails to match : : ./perl -wle '"a" =~ /^(a)?a$/;print $1' : Use of uninitialized value at -e line 1. It does match, but greed makes the ? give up its a, leaving $1 empty: #! /usr/bin/perl -w use strict; print q{"a" =~ /^(a)?a$/}, "\n"; if ("a" =~ /^(a)?a$/) { print "\$1 = `", defined $1 ? $1 : "<undef>", "'\n"; } else { print "No match.\n"; } [9:05] ruby% ./try "a" =~ /^(a)?a$/ $1 = `<undef>' : why does this match? : : ./perl -wle '"a" =~ /^(a)?(?(1)a|b)+$/;print $1' : a That looks like a bug to me. It should match, but $1 should be empty in that case. Greg


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org