my (@a,@b); ($a[$#a+1],$b[$#b+1]) = split /;/ while <>; print "@a\n"; print "@b\n"; #### 1;2 3;4 5;6 7;8 #### 1 3 5 7 2 4 6 8