#!/usr/bin/perl # https://perlmonks.org/?node_id=1230926 use strict; use warnings; my @array1 = (0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1); my @array2 = (0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1); #result should be #@arrayResult = (0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1); my @arrayResult = split ' ', "@array1" | "@array2"; use Data::Dump 'dd'; dd @arrayResult;