use Data::Dumper; my @array1 = qw( 1 2 3 ); my @array2 = qw( 4 ); unshift @array2, undef for @array1; print Dumper( \@array2 );