Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
print "Enter a variable name: ";
|
||||
$varname = <STDIN>; # type in "foo" on standard input
|
||||
chomp($varname);
|
||||
$$varname = 42; # when you try to dereference a string, it will be
|
||||
# treated as a "symbolic reference", where they
|
||||
# take the string as the name of the variable
|
||||
print "$foo\n"; # prints "42"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
use strict;
|
||||
|
||||
print "Enter a variable name: ";
|
||||
my $foo;
|
||||
my $varname = <STDIN>; # type in "foo" on standard input
|
||||
chomp($varname);
|
||||
my $varref = eval('\$' . $varname);
|
||||
$$varref = 42;
|
||||
print "$foo\n"; # prints "42"
|
||||
Loading…
Add table
Add a link
Reference in a new issue