use strict; my @array1=qw(1 2 3 4); my @array2=qw(4 3 2 1); #ascending my $i =0; while($i<= $#array1){ print $array1[$i] - $array2[$i],"\n"; $i++; }
UPDATED: Comments added...#Descending my $i = $#array1+1; #or # my $i = @array1; print $array1[$i] -$array2[$i],"\n" while $i--;
In reply to Re: compare arrays numbers
by biohisham
in thread compare arrays numbers
by nicholaspr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |