#!/usr/bin/perl
#
# Usage as arb ACI, e.g.:
#
#     readdb(test)|exec(sortListNumeric.pl)
#
# - reads data to sort from field 'test' (single entries in data need to be space separated)
# - sorts all entries numerically and concatenates them (into one new data entry)

use strict;
use warnings;


sub main() {
  my $line = <STDIN>;
  chomp($line);
  my @words = split /\s+/, $line;

  my @sorted = sort {
    my $cmp = $a <=> $b;
    if ($cmp==0) {
      $cmp = $a cmp $b;
    }
    $cmp;
  } @words;
  my $sline = join ' ',@sorted;

  print "$sline";
}
main();
