develooper Front page | perl.perl5.porters | Postings from June 2017

[perl #131664] Interpolation of @{^CAPTURE} and its friends doesn'twork

Thread Next
From:
Kenichi Ishigaki
Date:
June 28, 2017 05:10
Subject:
[perl #131664] Interpolation of @{^CAPTURE} and its friends doesn'twork
Message ID:
rt-4.0.24-14949-1498549716-840.131664-75-0@perl.org
# New Ticket Created by  Kenichi Ishigaki 
# Please include the string:  [perl #131664]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=131664 >



This is a bug report for perl from ishigaki@cpan.org,
generated with the help of perlbug 1.40 running under perl 5.26.0.


-----------------------------------------------------------------
[Please describe your issue here]
Interpolation of newly introduced @{^CAPTURE} and its friends doesn't work well.
See the following examples:

$ perl -E '"a"=~/(.)/; say ${^CAPTURE}[0]; say "${^CAPTURE}[0]"'
a
[0]

$ perl -E '"a"=~/(.)/; say @{^CAPTURE}; say "@{^CAPTURE}"'
a
a

$ perl -E '"a"=~/(?<b>.)/; say ${^CAPTURE}{b}; say "${^CAPTURE}{b}"'
a
{b}

$ perl -E '"a"=~/(?<b>.)/; say %{^CAPTURE}; say "%{^CAPTURE}"'
ba
%{^CAPTURE}

$ perl -E '"a"=~/(?<b>.)/; say @{^CAPTURE}{b}; say "@{^CAPTURE}{b}"'
a
a{b}

$ perl -E '"a"=~/(?<b>.)/; say %{^CAPTURE}{b}; say "%{^CAPTURE}{b}"'
ba
%{^CAPTURE}{b}

$ perl -E '"a"=~/(?<b>.)/; say ${^CAPTURE_ALL}{b}; say "${^CAPTURE_ALL}{b}"'
a
{b}

$ perl -E '"a"=~/(?<b>.)/; say %{^CAPTURE_ALL}; say "%{^CAPTURE_ALL}"'
ba
%{^CAPTURE_ALL}

$ perl -E '"a"=~/(?<b>.)/; say @{^CAPTURE_ALL}{b}; say "@{^CAPTURE_ALL}{b}"'
a
{b}

$ perl -E '"a"=~/(?<b>.)/; say %{^CAPTURE_ALL}{b}; say "%{^CAPTURE_ALL}{b}"'
ba
%{^CAPTURE_ALL}{b}

Hope this helps.

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

Configured by ishigaki at Wed May 31 14:15:00 JST 2017.

Summary of my perl5 (revision 5 version 26 subversion 0) configuration:
   
  Platform:
    osname=linux
    osvers=3.16.0-4-amd64
    archname=x86_64-linux
    uname='linux charsbar.org 3.16.0-4-amd64 #1 smp debian 3.16.39-1 (2016-12-30) x86_64 gnulinux '
    config_args='-Dprefix=/home/ishigaki/.plenv/versions/5.26.0 -de -Dusedevel -A'eval:scriptdir=/home/ishigaki/.plenv/versions/5.26.0/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='4.9.2'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.48

---
@INC for perl 5.26.0:
    /home/ishigaki/.plenv/versions/5.26.0/lib/perl5/site_perl/5.26.0/x86_64-linux
    /home/ishigaki/.plenv/versions/5.26.0/lib/perl5/site_perl/5.26.0
    /home/ishigaki/.plenv/versions/5.26.0/lib/perl5/5.26.0/x86_64-linux
    /home/ishigaki/.plenv/versions/5.26.0/lib/perl5/5.26.0

---
Environment for perl 5.26.0:
    HOME=/home/ishigaki
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ishigaki/.plenv/versions/5.26.0/bin:/home/ishigaki/.plenv/libexec:/home/ishigaki/.plenv/plugins/perl-build/bin:/home/ishigaki/.rakudobrew/bin:/home/ishigaki/.rbenv/shims:/home/ishigaki/.rbenv/bin:/home/ishigaki/.plenv/shims:/home/ishigaki/.plenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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