in reply to getting scalars out from txt file

Manipulating the symbol table for something this trivial is guaranteed to give you headaches sooner rather than later. Do consider using a structure, such as the one in Roger's solution. It will also allow you to use use strict which will greatly help you find errors.

btw, your print loop would be the following with his structure:

for ($i=0; $i<@vars; $i++) { print $var[$i]{num}, '||', $var[$i]{txt}, "\n"; }

or

foreach (@vars) { { print $_->{num}, '||', $_->{txt}, "\n"; }