in reply to How to replace empty values with value in previous array

I have an array which is joined by ';'

you CANT "have an array which is joined by ';'". you could have a string where ';' is a delimiter. So your example code wont even work. did you even try it first?

Anyway if they were valid arrays

for my $i (0..$#next_loop) { $next_loop[$i]=$first_loop[$i] unless (defined ($next_loop[$i]) and +$next_loop[$i] ne ''); }