develooper Front page | perl.perl5.porters | Postings from December 2016

[perl #130367] perl thinks a hash is a scalar in push/keys errormessages

Thread Previous
From:
Tony Cook via RT
Date:
December 19, 2016 00:04
Subject:
[perl #130367] perl thinks a hash is a scalar in push/keys errormessages
Message ID:
rt-4.0.24-28479-1482105770-1713.130367-15-0@perl.org
On Sat, 17 Dec 2016 08:01:20 -0800, xsawyerx@gmail.com wrote:
> When attempting to run "push" on a hash, we get the same error as when
> on a scalar, except it still includes the word "scalar", even though
> it's a hash. Haven't checked pop/shift/unshift, but I imagine they're
> the same.

Something like the attached?

$ ./perl -e 'push %x,1;' -e 'pop %x;' -e 'push *x,1;' -e 'pop *x;'
Type of arg 1 to push must be array (not hash dereference) at -e line 1, near "1;"
Type of arg 1 to pop must be array (not hash dereference) at -e line 2, near "%x;"
Type of arg 1 to push must be array (not ref-to-glob cast) at -e line 3, near "1;"
Type of arg 1 to pop must be array (not ref-to-glob cast) at -e line 4, near "*x;"
Execution of -e aborted due to compilation errors.

which matches what older perls did for the same code:

 *x;'
Type of arg 1 to push must be array (not hash dereference) at -e line 1, near "1;"
Type of arg 1 to pop must be array (not hash dereference) at -e line 2, near "%x;"
Type of arg 1 to push must be array (not ref-to-glob cast) at -e line 3, near "1;"
Type of arg 1 to pop must be array (not ref-to-glob cast) at -e line 4, near "*x;"
Execution of -e aborted due to compilation errors.

without removing the useful message that the experimental feature has been removed.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=130367

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