in reply to getting scalars out from txt file

How about something like this - build an array of hash references:
use IO::File; use Data::Dumper; my $f = new IO::File "file.txt", "r" or die "Can not open file"; my @vars; while (<$f>) { my ($d, $t) = $_ =~ /^(\d+)\|\|(\w+)$/; push @vars, { num => $d, txt => $t }; } print Dumper(\@vars);

The structure will be something like:
@vars = [ { num => '123', txt => 'abc' }, { num => '234', txt => 'frt' }, ... ];

To retrieve the variables:
$var[0]->{num}, $var[1]->{txt}, etc...