mcaongusa has asked for the wisdom of the Perl Monks concerning the following question:
I have a file with: $r in it. I tried:
#!/usr/bin/perl -w use strict; open(VARNAME, "varname"); my $varname = <VARNAME>; chomp($varname); print "$varname\n"; eval 'my $$varname = 10'; print "$r\n";
and I can't figure out what I am doing wrong. I want $r to exist as a variable in the code,
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: get variable from file to exist within perl code
by 1nickt (Canon) on May 15, 2018 at 13:02 UTC | |
Re: get variable from file to exist within perl code
by Athanasius (Archbishop) on May 15, 2018 at 13:37 UTC | |
Re: get variable from file to exist within perl code
by hippo (Archbishop) on May 15, 2018 at 13:19 UTC | |
Re: get variable from file to exist within perl code
by afoken (Chancellor) on May 15, 2018 at 20:30 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |