# Code1 @s = sort mycriteria @a; sub mycriteria { my($aa) = $a =~ /(\d+)/; my($bb) = $b =~ /(\d+)/; sin($aa) <=> sin($bb) || $aa*$aa <=> $bb*$bb; }