Created
May 21, 2017 20:29
-
-
Save andrewsolomon/e53137b1c9710c9778e19d7c97387153 to your computer and use it in GitHub Desktop.
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/perl | |
use strict; | |
use warnings; | |
use Data::Dump 'pp'; | |
use feature 'say'; | |
my $r_foo = sub { return "foo"; }; | |
my $r_bar = sub { return {this => 1, that => 2}; }; | |
sub call_sub { | |
my $sub = shift; | |
my $retval = $sub->(); | |
return $retval; | |
} | |
say 'r_foo returns '.pp(call_sub($r_foo)); | |
say 'r_bar returns '.pp(call_sub($r_bar)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment