in reply to Re^2: merging two arrays with OR operation
in thread merging two arrays with OR operation
There is nothing wrong with your code except that the if (($array1[$i] eq 0)&&($array2[$i] eq 0)) {... code could be replaced by:
$result[$i] = $array1[$i] | $array2[$i];
and your for loop is better written:
for my $i (0 .. $#array1)
Note that for and foreach are identical aside from the spelling so personally I never use foreach just because that way I type less.
|
|---|