Skip Menu |
Report information
Id: 131328
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: altreus [at] altre.us
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



Subject: Delete does not work on % slices
Date: Fri, 19 May 2017 11:22:45 +0100
To: perlbug [...] perl.org
From: altreus [...] altre.us
Download (untitled) / with headers
text/plain 3.9k
This is a bug report for perl from altreus@altre.us, generated with the help of perlbug 1.40 running under perl 5.20.1. ----------------------------------------------------------------- The `delete` operator deletes one or many keys from a hash and returns the deleted values. This works on $ and @ sections of a hash. It seems logical that if one were to run delete on a % section of a hash, it would return the k-v-pair list that was deleted. my %sanitised_values = delete %input_values{@allowed_keys}; warn "Unknown key $_" for keys %input_values; ----------------------------------------------------------------- --- Flags: category=core severity=wishlist --- Site configuration information for perl 5.20.1: Configured by alastair.mcgowan at Thu Jan 29 12:23:29 GMT 2015. Summary of my perl5 (revision 5 version 20 subversion 1) configuration: Platform: osname=linux, osvers=3.13.0-43-generic, archname=x86_64-linux uname='linux dev-05 3.13.0-43-generic #72-ubuntu smp mon dec 8 19:35:06 utc 2014 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1 -Aeval:scriptdir=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.8.2', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 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 -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/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=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-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' Locally applied patches: Devel::PatchPerl 1.30 --- @INC for perl 5.20.1: /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1 /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 . --- Environment for perl 5.20.1: HOME=/home/alastair.mcgowan LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/alastair.mcgowan/venv/bin:/home/alastair.mcgowan/src/rakudobrew/bin:/home/alastair.mcgowan/src/mg-scripts:/home/alastair.mcgowan/bin:/home/alastair.mcgowan/GitScripts:/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin:/home/alastair.mcgowan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PERLBREW_BASHRC_VERSION=0.66 PERLBREW_HOME=/home/alastair.mcgowan/.perlbrew PERLBREW_MANPATH=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/man PERLBREW_PATH=/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/bin PERLBREW_PERL=perl-5.20.1 PERLBREW_ROOT=/home/alastair.mcgowan/perl5/perlbrew PERLBREW_VERSION=0.66 PERL_BADLANG (unset) SHELL=/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 4.4k
On Fri, 19 May 2017 10:40:45 GMT, altreus@altre.us wrote: Show quoted text
> > This is a bug report for perl from altreus@altre.us, > generated with the help of perlbug 1.40 running under perl 5.20.1. > > > ----------------------------------------------------------------- > > The `delete` operator deletes one or many keys from a hash and returns > the > deleted values. This works on $ and @ sections of a hash. > > It seems logical that if one were to run delete on a % section of a > hash, it > would return the k-v-pair list that was deleted. > > my %sanitised_values = delete %input_values{@allowed_keys}; > warn "Unknown key $_" for keys %input_values; > >
Can you explain your concept of the '$', '@' and '%' "sections" of a hash? I have been programming in Perl for some time and have never heard of "sections" of a hash. Nor can I find any mention of them in the documentation. Thank you very much. Jim Keenan ----------------------------------------------------------------- Show quoted text
> --- > Flags: > category=core > severity=wishlist > --- > Site configuration information for perl 5.20.1: > > Configured by alastair.mcgowan at Thu Jan 29 12:23:29 GMT 2015. > > Summary of my perl5 (revision 5 version 20 subversion 1) > configuration: > > Platform: > osname=linux, osvers=3.13.0-43-generic, archname=x86_64-linux > uname='linux dev-05 3.13.0-43-generic #72-ubuntu smp mon dec 8 > 19:35:06 utc 2014 x86_64 x86_64 x86_64 gnulinux ' > config_args='-de > -Dprefix=/home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1 > -Aeval:scriptdir=/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin' > hint=recommended, useposix=true, d_sigaction=define > useithreads=undef, usemultiplicity=undef > use64bitint=define, use64bitall=define, uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack- > protector -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64', > optimize='-O2', > cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector > -I/usr/local/include' > ccversion='', gccversion='4.8.2', gccosandvers='' > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 > 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 -L/usr/local/lib' > libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/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=-lnsl -ldl -lm -lcrypt -lutil -lc > perllibs=-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' > > Locally applied patches: > Devel::PatchPerl 1.30 > > --- > @INC for perl 5.20.1: > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/site_perl/5.20.1/x86_64-linux > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/site_perl/5.20.1 > /home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/lib/5.20.1/x86_64-linux > /home/alastair.mcgowan/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 > . > > --- > Environment for perl 5.20.1: > HOME=/home/alastair.mcgowan > LANG=en_GB.UTF-8 > LANGUAGE=en_GB:en > LD_LIBRARY_PATH (unset) > LOGDIR (unset) > PATH=/home/alastair.mcgowan/venv/bin:/home/alastair.mcgowan/src/rakudobrew/bin:/home/alastair.mcgowan/src/mg- > scripts:/home/alastair.mcgowan/bin:/home/alastair.mcgowan/GitScripts:/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin:/home/alastair.mcgowan/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games > PERLBREW_BASHRC_VERSION=0.66 > PERLBREW_HOME=/home/alastair.mcgowan/.perlbrew > PERLBREW_MANPATH=/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/man > PERLBREW_PATH=/home/alastair.mcgowan/perl5/perlbrew/bin:/home/alastair.mcgowan/perl5/perlbrew/perls/perl- > 5.20.1/bin > PERLBREW_PERL=perl-5.20.1 > PERLBREW_ROOT=/home/alastair.mcgowan/perl5/perlbrew > PERLBREW_VERSION=0.66 > PERL_BADLANG (unset) > SHELL=/bin/bash
-- James E Keenan (jkeenan@cpan.org)
Subject: Re: [perl #131328] Delete does not work on % slices
From: Lukas Mai <plokinom [...] gmail.com>
To: perl5-porters [...] perl.org
Date: Fri, 19 May 2017 13:23:13 +0200
Download (untitled) / with headers
text/plain 836b
Am 19.05.2017 um 13:20 schrieb James E Keenan via RT: Show quoted text
> On Fri, 19 May 2017 10:40:45 GMT, altreus@altre.us wrote:
>> >> The `delete` operator deletes one or many keys from a hash and returns >> the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a >> hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values; >> >>
> > Can you explain your concept of the '$', '@' and '%' "sections" of a hash? > > I have been programming in Perl for some time and have never heard of "sections" of a hash. Nor can I find any mention of them in the documentation.
http://perldoc.perl.org/perldata.html#Slices -- Lukas Mai <plokinom@gmail.com>
RT-Send-CC: perl5-porters [...] perl.org
On Fri, 19 May 2017 11:23:41 GMT, plokinom@gmail.com wrote: Show quoted text
> Am 19.05.2017 um 13:20 schrieb James E Keenan via RT:
> > On Fri, 19 May 2017 10:40:45 GMT, altreus@altre.us wrote:
> >> > >> The `delete` operator deletes one or many keys from a hash and > >> returns > >> the > >> deleted values. This works on $ and @ sections of a hash. > >> > >> It seems logical that if one were to run delete on a % section of a > >> hash, it > >> would return the k-v-pair list that was deleted. > >> > >> my %sanitised_values = delete %input_values{@allowed_keys}; > >> warn "Unknown key $_" for keys %input_values; > >> > >>
> > > > Can you explain your concept of the '$', '@' and '%' "sections" of a > > hash? > > > > I have been programming in Perl for some time and have never heard of > > "sections" of a hash. Nor can I find any mention of them in the > > documentation.
> > http://perldoc.perl.org/perldata.html#Slices
I'm familiar with slices. It's the OP's use of the term "sections" that puzzles me. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
To: perl5-porters [...] perl.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Subject: Re: [perl #131328] Delete does not work on % slices
Date: Sat, 20 May 2017 14:22:52 +0100
Download (untitled) / with headers
text/plain 955b
(via RT) <perlbug-followup@perl.org> writes: Show quoted text
> The `delete` operator deletes one or many keys from a hash and returns the > deleted values. This works on $ and @ sections of a hash. > > It seems logical that if one were to run delete on a % section of a hash, it > would return the k-v-pair list that was deleted. > > my %sanitised_values = delete %input_values{@allowed_keys}; > warn "Unknown key $_" for keys %input_values;
As is my wont, I thought "how hard could it possibly be" and had a go. Turns out not very hard at all, so the result is now on the smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, unless anyone objects. https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice -- "The surreality of the universe tends towards a maximum" -- Skud's Law "Never formulate a law or axiom that you're not prepared to live with the consequences of." -- Skud's Meta-Law
Date: Mon, 22 May 2017 11:19:55 +0200
Subject: Re: [perl #131328] Delete does not work on % slices
From: Sawyer X <xsawyerx [...] gmail.com>
To: Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org>, perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 812b
On 05/20/2017 03:22 PM, Dagfinn Ilmari Mannsåker wrote: Show quoted text
> (via RT) <perlbug-followup@perl.org> writes: >
>> The `delete` operator deletes one or many keys from a hash and returns the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values;
> As is my wont, I thought "how hard could it possibly be" and had a go. > Turns out not very hard at all, so the result is now on the > smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, > unless anyone objects.
Also possible to merge to blead-next, which will be merged when 5.27 opens.
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
Date: Fri, 02 Jun 2017 11:05:51 +0100
Subject: Re: [perl #131328] Delete does not work on % slices
To: perl5-porters [...] perl.org
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes: Show quoted text
> (via RT) <perlbug-followup@perl.org> writes: >
>> The `delete` operator deletes one or many keys from a hash and returns the >> deleted values. This works on $ and @ sections of a hash. >> >> It seems logical that if one were to run delete on a % section of a hash, it >> would return the k-v-pair list that was deleted. >> >> my %sanitised_values = delete %input_values{@allowed_keys}; >> warn "Unknown key $_" for keys %input_values;
> > As is my wont, I thought "how hard could it possibly be" and had a go. > Turns out not very hard at all, so the result is now on the > smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, > unless anyone objects. > > https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice
This is now in blead as commit cc0776d645a326dd0aaa2dbd8cd9b014c63723f5. -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen
To: Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org>
Subject: Re: [perl #131328] Delete does not work on % slices
Date: Fri, 2 Jun 2017 14:16:53 +0200
From: demerphq <demerphq [...] gmail.com>
CC: Perl5 Porteros <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 1.1k
On 2 June 2017 at 12:05, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote: Show quoted text
> ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes: >
>> (via RT) <perlbug-followup@perl.org> writes: >>
>>> The `delete` operator deletes one or many keys from a hash and returns the >>> deleted values. This works on $ and @ sections of a hash. >>> >>> It seems logical that if one were to run delete on a % section of a hash, it >>> would return the k-v-pair list that was deleted. >>> >>> my %sanitised_values = delete %input_values{@allowed_keys}; >>> warn "Unknown key $_" for keys %input_values;
>> >> As is my wont, I thought "how hard could it possibly be" and had a go. >> Turns out not very hard at all, so the result is now on the >> smoke-me/ilmari/delete-kvslice branch and can be merged once 5.27 opens, >> unless anyone objects. >> >> https://perl5.git.perl.org/perl.git/commitdiff/smoke-me/ilmari/delete-kvslice
> > This is now in blead as commit cc0776d645a326dd0aaa2dbd8cd9b014c63723f5.
I'll just note that the new syntax was an error in previous perl's, in case anyone was wondering like I was. Which is real cool. Thanks for making it happen! cheers, Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"


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