-
Notifications
You must be signed in to change notification settings - Fork 560
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
sort mygrep {1} keys %hash ...will not compile #15304
Comments
From @jimavThis is a bug report for perl from jim.avera@gmail.com, sub mygrep (&@) { } my @b = sort grep {1} keys %ENV; # works Flags: Site configuration information for perl 5.20.2: Configured by Debian Project at Tue Mar 1 16:51:39 UTC 2016. Summary of my perl5 (revision 5 version 20 subversion 2) configuration: Locally applied patches: @INC for perl 5.20.2: Environment for perl 5.20.2: |
From @cpansproutOn Mon May 02 14:41:04 2016, jim.avera@gmail.com wrote: The sort operator has ‘extra special’ parsing rules.
It compiles, but gives: Sort subroutine didn't return single value at -e line 1. because mygrep is the sort comparison routine, and {1}, keys %ENV (i.e., an anonymous hash, followed by the env var names) is the list of items to sort.
Here, the list of items to sort is ({1} keys %ENV), which contains a syntax error. Use +mygrep if you intend mygrep to be part of the source list. This is documented in perfunc: Warning: syntactical care is required when sorting the list my @contact = sort { $a cmp $b } find_records @key; If instead you want to sort the array @key with the comparison my @contact = sort { find_records() } @key; Not a bug. -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
@cpansprout - Status changed from 'open' to 'rejected' |
From @jimavOk, thanks for the reference. On 05/02/2016 03:03 PM, Father Chrysostomos via RT wrote:
|
Migrated from rt.perl.org#128057 (status was 'rejected')
Searchable as RT128057$
The text was updated successfully, but these errors were encountered: