in reply to subtraction in array

Sidac:

You can tell perl to read entire records at a time by setting the input record separator to a blank line (see perlvar). Then you can split the record on whitespace, like so:

$ cat t.pl #!/usr/bin/perl use strict; use warnings; use List::MoreUtils qw<pairwise>; $/=""; my @list1 = split /\s+/, <DATA>; my @list2 = split /\s+/, <DATA>; my @diff = pairwise { $b-$a } @list2, @list1; print join(", ", @diff),"\n"; __DATA__ 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 $ perl t.pl Name "main::b" used only once: possible typo at t.pl line 9. Name "main::a" used only once: possible typo at t.pl line 9. 7.322, 6.497, 4.973, -8.754, -2.097, -3.123, -6.882

...roboticus

When your only tool is a hammer, all problems look like your thumb.