Created
August 30, 2015 21:00
-
-
Save andrewsolomon/67a2025b9e22c432a887 to your computer and use it in GitHub Desktop.
Typeglob example
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use Data::Dump 'pp'; | |
# Typeglob example - only works with dynamic (our) variables | |
# see http://perldoc.perl.org/perlmod.html#Symbol-Tables | |
our $foo = 'bar'; | |
our @foo = ('test', 'array'); | |
our %foo = ( test => 'hash' ); | |
{ | |
no strict 'vars'; | |
*bar = *foo; | |
say pp $bar; | |
say pp @bar; | |
say pp %bar; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment