#!/usr/bin/perl -s
$times=1 unless $times;
$n=3 unless $n;
@array = 1..$n;
@answer;
sub permutations {
  unless (@array){
    print(" @answer \n") unless $quiet;
    return;
  }
  for (0..@array-1){
    push @answer, splice(@array,$_,1);
    permutations();
    splice(@array, $_, 0, pop @answer);
  }
}
print "-- permutations of $n digits, $times time(s) --\n";
permutations() while $times--;
