develooper Front page | perl.perl5.porters | Postings from September 2000

[ID 20000901.008] Scoping (?) oddities with pos()

Thread Next
From:
Mike Guy
Date:
September 1, 2000 03:06
Subject:
[ID 20000901.008] Scoping (?) oddities with pos()
Message ID:
E13Unhe-0000uo-00@draco.cus.cam.ac.uk
There seem to be funny scoping effects with pos():

#perl -wl
$x = 'a' x 200 . 'b';
{ $x =~ /b/g; };
print pos $x;
{ $x =~ /b/g; $y = pos $x };
print "$y ", pos $x;
print do { $x =~ /b/g; pos $x };
__END__
201
Use of uninitialized value in concatenation (.) or string at - line 5.
Use of uninitialized value in print at - line 5.
 
201

Test is with bleedperl, but the same behaviour goes back to at least
5.004_04.

Mike Guy

# perl -V
Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname=''
    config_args='-dOes -Dusedevel -f confug.sh'
    hint=previous, 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.7.2.3, gccosandvers=solaris2.6
    cppflags='-I/usr/local/include -I/opt/local/include -DREG_INFTY=22786'
    ccflags ='-I/usr/local/include -I/opt/local/include -DREG_INFTY=22786'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    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 -L/opt/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Locally applied patches:
  	DEVEL6918
  Built under solaris
  Compiled at Aug 30 2000 19:07:04
  @INC:
    /home/mjtg/perl5.6.0x/lib
    /home/mjtg/perl5.6.0x/lib
    /home/mjtg/perl5.6.0x/lib
    /home/mjtg/perl5.6.0x/lib
    .


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