develooper Front page | perl.perl5.porters | Postings from August 2001

[ID 20010814.004] pos() doesn't work when using =~m// in list context

Thread Next
From:
Greg London
Date:
August 14, 2001 05:40
Subject:
[ID 20010814.004] pos() doesn't work when using =~m// in list context
Message ID:
3B791C11.1D444EE7@oaktech.com


This is a bug report for perl from greglondon@oaktech.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


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

when m// is used in list context

	i.e. my @matches = $string=~m/pattern/;

the value returned by pos($string) is incorrect.

here's a code sample with and without list context.

	my $hstr1 = "fee fie foe foo";
	$hstr1 =~ m/e/mcg;
	print "position is ".pos($hstr1)."\n";

	my $hstr2 = "fee fie foe foo";
	my @matches = $hstr2 =~ m/e/mcg;
	print "position is ".pos($hstr2)."\n";

The output from this script is:

	position is 2
	Use of uninitialized value in concatenation (.) at .//junk.pl line 11.
	position is 

This isn't documented anywhere that I could find
in "Programming Perl" under the pos() function
description, or under the section of pattern matching.







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

Configured by cote at Mon Jan  8 09:26:45 EST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris
    uname='sunos beast 5.7 generic_106541-11 sun4u sparc sunw,ultra-5_10
'
    config_args='-Dcc=gcc -Dprefix=/opt/perl -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include
-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
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /tools/pm/bin
    /opt/perl/lib/5.6.0/sun4-solaris
    /opt/perl/lib/5.6.0
    /opt/perl/lib/site_perl/5.6.0/sun4-solaris
    /opt/perl/lib/site_perl/5.6.0
    /opt/perl/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/london
    LANG=C
    LANGUAGE (unset)
   
LD_LIBRARY_PATH=/usr/openwin/lib:/usr/dt/lib:/tools/affirma/ldv3.1/tools/lib:/usr/openwin/lib:/usr/local/lib:/usr/openwin/share/include/X11:/usr/lib
    LOGDIR (unset)
   
PATH=/home/london/pm/bin:/tools/debussy/bin:/tools/affirma/ldv3.1/tools/dfII/bin:/tools/affirma/ldv3.1/tools/bin:/tools/affirma/ldv3.1/tools/inca/bin:/tools/lsf/4.1/sparc-sol7-64/etc:/tools/lsf/4.1/sparc-sol7-64/bin:/tools/vcs/5.1/bin:/tools/vcs/5.1/sun_sparc_solaris_5.5.1/bin:/tools/vcs/5.1/sun_sparc_solaris_5.5.1/util:/tools/vcs/5.1/sun_sparc_solaris_5.5.1/flexlm:/tools/transeda/vn6.0.1/bin/SunOS5:/tools/synopsys/2000.11-SP1/sparcOS5/syn/bin:/tools/synopsys/2000.11-SP1/sparc64/syn/bin:/tools/synopsys/2000.11-SP1:/tools/synopsys/scl/sparcOS5/bin:/tools/synopsys/2000.11-SP1/sparc64/syn/bin:./:/home/london/bin:/home/london/synmake:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/ucb:/etc:/usr/openwin/bin:/usr/X/bin:/usr/openwin/bin/xview:/usr/openwin/bin:/usr/openwin/demo:/usr/ccs/bin:/usr/dt/bin:/usr/java/bin:/tools/pm/bin:/opt/nEtscape:/usr/elroy:/tools/screener/bin:/tools/pm/bin:/home/london/Office51/bin
    PERLLIB=/tools/pm/bin
    PERL_BADLANG (unset)
    SHELL=/bin/csh




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About