Help for this page

Select Code to Download


  1. or download this
    my @sorted = sort {
        if ($a->title =~ /Manager/ and not $b->title =~ /Manager/) {
    ...
            $a->name cmp $b->name;
        }
    } @employees;
    
  2. or download this
    my @sorted = sort {
        ($a->title !~ /Manager/) - ($b->title !~ /Manager/)
        or $a->name cmp $b->name;
    } @employees;
    
  3. or download this
    use List::MoreUtils qw( part );
    
    ...
        map  { sort { $a->name cmp $b->name } @$_ }
        part { $_->title !~ /Manager/ }
        @employees;
    
  4. or download this
    use v5.14;
    use strict;
    ...
    }
    
    done_testing();
    
  5. or download this
    use v5.14;
    use strict;
    ...
        subtle     => \&subtle,
        functional => \&functional,
    });
    
  6. or download this
    my @sorted = 
        map  { keysort { $_->name } @$_ }
        part { $_->title !~ /Manager/ }
        @employees;