in reply to getting scalars out from txt file

The problem is in the $numb."[$i]". This code produces a string value that is not a lvalue.

Probably you may use an array

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