Skip to content

Instantly share code, notes, and snippets.

@andrewsolomon
Created August 30, 2015 21:00
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 andrewsolomon/67a2025b9e22c432a887 to your computer and use it in GitHub Desktop.
Save andrewsolomon/67a2025b9e22c432a887 to your computer and use it in GitHub Desktop.
Typeglob example
#!/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