# Pastebin XYmjLZzu class Person { has Str $.name; has Int $.age; method cmp(Person $other) { return $.age cmp $other.age; # Compare by age } } my @people = ( Person.new(name => "Alice", age => 30), Person.new(name => "Bob", age => 25), Person.new(name => "Charlie", age => 35) ); say @people.sort; # Sorts based on age