-
Notifications
You must be signed in to change notification settings - Fork 578
Array slice indexing bug (when mixing positive and negative notation) #5559
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
Comments
From [email protected]This is a bug report for perl from torbenh@mips.com, #!/usr/local/bin/perl -w # I hope the bug is obvious: I expect all the 4 last cases to be the same @a = qw(1 2 3 4 5); print("\@a: @a\n"); Flags: Site configuration information for perl v5.6.1: Configured by steve at Wed Apr 25 02:36:44 EDT 2001. Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Locally applied patches: @INC for perl v5.6.1: Environment for perl v5.6.1: |
From [Unknown Contact. See original ticket]On Jun 11, Torben Vendt Hansen said:
It is not a bug.
@a[-2 .. 4] is merely shorthand for @a[-2, -1, 0, 1, 2, 3, 4], which is -- |
From @schwernOn Tue, Jun 11, 2002 at 10:41:58AM -0400, Jeff 'japhy' Pinyan wrote:
Maybe the bug is that it doesn't produce a warning when used backwards. $ perl -wle '@a = qw(1 2 3 4 5); print @a[3 .. -1]' Or maybe it should just work backwards. :) -- |
From [Unknown Contact. See original ticket]-----BEGIN PGP SIGNED MESSAGE----- Moin,
You could overload it. Oh wait, I never managed to bribe^Wlobby someone to - -- http://bloodgate.com/perl My current Perl projects -----BEGIN PGP SIGNATURE----- iQEVAwUBPQZvGXcLPEOTuEwVAQHNsQf+Ml4PTgnv4B2OhAFsyJBmg4k1GtCQN4/1 |
From @AbigailOn Tue, Jun 11, 2002 at 03:43:07PM -0400, Michael G Schwern wrote:
I don't think so. I find the behaviour useful and I often exploit it. # Deal with the rest of the array. And this neatly skips doesn't run the loop if the range is empty,
Abigail |
From @iabynOn Wed, Jun 12, 2002 at 02:59:10AM -0700, Abigail wrote:
Maybe a warning only when both values are constant? Dave. -- |
Migrated from rt.perl.org#9533 (status was 'resolved')
Searchable as RT9533$
The text was updated successfully, but these errors were encountered: