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

And a complete solution:

use strict; use warnings; my @array=qw/a b c d/; my $diff = join"",map{s/(\d+)/$array[$1]/g;$_.$/}grep{eval$_<0}glob("{ +".join(",",0..$#array)."}-{".join(",",0..$#array)."}"); my $prod = $diff; $prod =~ tr/-/./; print "Differences:\n$diff\nProducts:\n$prod";
  • 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