42.034 41.630 40.158 26.823 26.366 25.289 23.949 34.712 35.133 35.185 35.577 28.463 28.412 30.831 33.490 33.839 32.059 32.072 33.425 33.349 34.709 <\code> the groups are always of equal length and can be arranged in more than one line long, (if the group is large, say 500 numbers long); seperated by blank lines ! My question is: how should I subtract the first element of array 2 from array 1, array 3 from array 2, similarly for the second element and so on till the end of the group? i.e.: 34.712-42.034,35.133-41.630,35.185-40.158 ...till the end of each group 33.490-34.712,33.839-35.133 .................. I did use pairwise , use List::MoreUtils qw; But i am unable to assign them into array correctly while (){ my @list1 = split ' ', ; my @list2 = split ' ', ; my @diff = pairwise { $b - $a } @list2, @list1; }