foreach (@file) { chomp; my ($n, $t) = split /\|\|/; push @numb, $n; push @text, $t; } print "$numb[$_]||$text[$_]\n" for 0 .. $#@numb;