New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$#{@$x} == -1 always, if $x is an array ref #9173
Comments
From @trwyantThis is a bug report for perl from wyant@cpan.org, Under Perl 5.10.0, $#{@$x} appears to return -1 no matter how many $ perl5.10.0 -le '$x = [1, 2, 3]; print $#{@$x}' $ perl5.8.8 -le '$x = [1, 2, 3]; print $#{@$x}' I didn't see anything in perldelta to cover this. Yes, the $# $ perl5.10.0 -le '@x = (1, 2, 3); print $#x' and $ perl5.10.0 -le '$x = [1, 2, 3]; print $#@$x' Flags: Site configuration information for perl 5.10.0: Configured by tom at Sat Dec 29 20:29:05 EST 2007. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: |
From @AbigailOn Sun, Dec 30, 2007 at 09:55:17AM -0800, Tom Wyant wrote:
Not a bug, but a bug fix. In your case, @$x equals 3 (as it's in scalar #!/usr/bin/perl use 5.010; use strict; no strict 'refs'; my $x = [1, 2, 3]; __END__ Which is what I would expect. Note that 'use strict' would have told you so: $ perl -Mstrict -le 'my Abigail |
The RT System itself - Status changed from 'new' to 'open' |
From blgl@hagernas.comHow come this gets reported so often? There's nothing in the current docs /Bo Lindbergh |
@rgs - Status changed from 'open' to 'rejected' |
From @demerphqOn 30/12/2007, Bo Lindbergh <blgl@hagernas.com> wrote:
There were bugs in older perls where some of this stuff worked fine. $ ./perl -Ilib -le'use strict; my %hash=(foo=>"bar"); print %hash->{foo};' Yves -- |
From @demerphqOn 31/12/2007, demerphq <demerphq@gmail.com> wrote:
Although its deprecated: $ ./perl -Ilib -lwe'use strict; my %hash=(foo=>"bar"); print %hash->{foo};' Maybe the change you asked about escaped a deprecation cycle? Yves -- |
From @demerphqOn 31/12/2007, Nicholas Clark <nick@ccl4.org> wrote:
This was documented?! Yves -- |
From @nwc10On Mon, Dec 31, 2007 at 01:02:51PM +0100, demerphq wrote:
No, I meant that the $# syntax was never documented that it worked that way. I intended to be studiously ambiguous on whether using a hash as a reference The hash as a reference appears to be merely a side effect of the grammar, Nicholas Clark |
From @nwc10On Mon, Dec 31, 2007 at 11:43:30AM +0100, demerphq wrote:
We didn't deprecate it. It was a bug which we fixed, rather than a change We considered the bug fix for 5.8.x for a while, but it turned out that a Yes, it will still cause pain when upgrading from 5.8.x to 5.10, but it's Nicholas Clark |
From @druud62Bo Lindbergh schreef:
I guess it comes from trying out constructs to get Probably $#$aref isn't intuitive? Arrays of possibly enormous size are copied just to get to it: my @tmp = @{$_[0]}; in stead of $#{$_[0]} (haven't searched google code yet to back my hunch) -- "Gewoon is een tijger." |
From @trwyantAnother $x = qr{foo}; m/$x/m huh? I found this in the test suite for a CPAN module. Seeing that the behavior changed between 5.8.8 and 5.10 I filed both places. The module bug is https://rt.cpan.org/Ticket/Display.html?id=32010 Thank you for your prompt response. I'll let the CPAN author know how it came out. Tom Wyant |
From @trwyantMessage RFC822: LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcg |
From @schwernBo Lindbergh wrote:
Because try something and it happens to work. And since they don't turn on -- |
Migrated from rt.perl.org#49230 (status was 'rejected')
Searchable as RT49230$
The text was updated successfully, but these errors were encountered: