Sort primes from list to a list

var arr = [2,43,81,122,63,13,7,95,103]
say arr.grep{.is_prime}.sort

Output:

[2, 7, 13, 43, 103]

Last updated