in reply to How can one find out the pairwise difference and product between elements in a perl array without using a perl module?

One way (differences and products are left as an exercise):
% perl -E '@a = 1 .. 4; for my $x (@a) { %set = map { $_ => 1 } @a; de +lete $set{$x}; say "$x, $_" for keys %set; }' 1, 4 1, 3 1, 2 2, 4 2, 1 2, 3 3, 4 3, 1 3, 2 4, 1 4, 3 4, 2 %
  • Comment on Re: How can one find out the pairwise difference and product between elements in a perl array without using a perl module?
  • Download Code