Welcome to the Monastery | |
PerlMonks |
How can one find out the pairwise difference and product between elements in a perl array without using a perl module?by supriyoch_2008 (Monk) |
on Sep 13, 2013 at 12:24 UTC ( [id://1053907]=perlquestion: print w/replies, xml ) | Need Help?? |
supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question: Hi PerlMonks, I have an array like @array = qw/a b c d/; I am interested to find out the pairwise difference and product between any two elements in the array by taking out each element from the array and then calculating the difference and the product as shown in the expected result. Since there are 4 elements, there will be n(n-1)/2=6 pairwise differences and products, where n=4.
The expected result should look like:
Back to
Seekers of Perl Wisdom
|
|