my @numbers = (7, 12, 49, 44); my @sorted = sort { print("Comparing $a with $b...\n"); $a <=> $b } @numbers;