develooper Front page | perl.perl6.users | Postings from June 2018

Re: need sort help

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
June 9, 2018 04:36
Subject:
Re: need sort help
Message ID:
8be48348-befb-6be2-ca83-9071bf1b9410@zoho.com
On 06/08/2018 09:25 PM, Brandon Allbery wrote:
> @x.sort: {
>     my $a = $^x ~~ m:g/\d+/;
>     my $b = $^y ~~ m:g/\d+/;
>     $a[6].defined cmp $b[6].defined
>     ??
>       $a[3] cmp $b[3]
>     || $a[1] cmp $b[1]
>     || $a[2] cmp $b[2]
>     || $a[4] cmp $b[4]
>     || $a[5] cmp $b[5]
>     || $a[6] cmp $b[6]
>     || $x cmp $y
>     !! $x cmp $y
> };
> 
> This is what I sent before, minus the leading "> " that I'd neglected to 
> remove.
> 
> Please note the second line does NOT say "my $a = $a ~~ m:g/\d+/;", 
> which is what you had and what produced the error you pasted. I don't 
> know where you got that. Likewise the third line with $b and $^y (where 
> again you had $b instead).
> 

It compiles without error.  What variable is the result in?

Thread Previous | Thread Next


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