Skip to content

Instantly share code, notes, and snippets.

@alexm
Created May 10, 2013 10:17
Show Gist options
  • Save alexm/5553592 to your computer and use it in GitHub Desktop.
Save alexm/5553592 to your computer and use it in GitHub Desktop.
Proof of concept defining a sub with a localized global.
#!/usr/bin/perl
use warnings;
use strict;
local *p = sub {
print "[", ( join ",", @_ ), "]\n";
};
p(qw( foo bar ));
my @a = 1 .. 10;
p(@a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment