develooper Front page | perl.perl5.porters | Postings from July 2010

[perl #4003] Can't chomp values %h

Thread Previous
From:
George Greer via RT
Date:
July 25, 2010 18:44
Subject:
[perl #4003] Can't chomp values %h
Message ID:
rt-3.6.HEAD-11314-1280108684-540.4003-15-0@perl.org
On Wed Aug 30 09:22:19 2000, RT_System wrote:
> In article <13564.967673497@chthon>,
> Tom Christiansen <tchrist@chthon.perl.com> wrote:
> > 
> > >rick $ /home/perl/bin/perl -le '%h=(1..4);chop values %h'
> > >Can't modify values in chop at -e line 1, at EOF
> > >Execution of -e aborted due to compilation errors.
> > 
> > "chop %h" is legal, and does what you think it does.
> 
> That's pretty vague.  chop %h does what chop values %h should do.  I
> think chop %h should be deprecated or made a syntax error now so that
> when someday we support modifiable sv keys we can make it do "what you
> think it does" then.
> 
> But chop values %h should certainly work.
> 
> Incidentally, chop on a hash slice seems to return the first char
> chopped, not the last (array slices do seem to work though).

'chop %h' was documented in 4bf21a6d.

'chop for values %h' also works, per the suggestion of a 'chop values %h'.

In testing v5.13.3-49-g01604df, I get the last value (4 in the example)
back from a hash slice so that seems good too.

As such, I'll resolve this.

-- 
George Greer

Thread Previous


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