Last active
June 25, 2018 13:40
-
-
Save tbrowder/e032014c641ff2e3fe542861298e6c16 to your computer and use it in GitHub Desktop.
scalar ref as hash value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given this Perl 5 script which allows a scalar reference | |
as a hash value: | |
#!/usr/bin/env perl | |
my $b = 0; | |
my %h = ( a => \$b ); | |
my $b1 = ${$h{a}}; | |
print "\$b1 = $b1\n"; # output: 0 | |
$b = 1; | |
$b1 = ${$h{a}}; | |
print "\$b1 = $b1\n"; # output: 1 | |
What is an equivalent Perl 6 script to bind an in-scope variable | |
to a hash key? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment