Showing posts with label Sorting array of numbers in perl. Show all posts
Showing posts with label Sorting array of numbers in perl. Show all posts

Thursday, October 20, 2022

Sorting array of numbers in perl

 

@numbers = (13, 9, 22, 27, 1, 3, -4, 10);
print "Original: @numbers\n\n";

@sorted_numbers = sort { $a <=> $b } @numbers;

print "After sorting: @sorted_numbers";