my $string = join ('-@-', sort@array); # My output # The string contains five-@-four-@-one-@-three-@-two