I have a large file with a list of variables (about 15,000) in this format:
$1111111 = x11111;
$1111112 = x11112;
$1111113 = x11113;
$1111114 = y11214;
$1111115 = x11583;
...
I've got to include the file with the variables in another Perl script. This Perl script opens another file and checks the content of this file line by line. The lines start with e.g. 11111111, 1111112, ... When the line starts with 1111111 I've got to show x11111 in the output.
$1111111 = 'foo';
print $1111111;
will produce an error: Modification of a read-only value attempted at script line 1.
You may need to read that file as a text file and convert it into a hash if you can't change the naming scheme of the variables.
I think that variables that start with numbers are reserved by perl
I agree. I always remember from my C/C++ days that you shouldn't start variable names with a number.
The hash method will work for you though, although there is one mistake, single quotes don't need escape characters....
Then $data_hash{'$1111111'} would have the value "x11111".
And you should define %data_hash beforehand.