Skip to content

Instantly share code, notes, and snippets.

@tbrowder
Last active June 25, 2018 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbrowder/e032014c641ff2e3fe542861298e6c16 to your computer and use it in GitHub Desktop.
Save tbrowder/e032014c641ff2e3fe542861298e6c16 to your computer and use it in GitHub Desktop.
scalar ref as hash value
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