Created
July 12, 2016 15:59
-
-
Save nicomen/79cbf2a7d26775e8e1daef1937e6fd9a to your computer and use it in GitHub Desktop.
Block syntax question
This file contains hidden or 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
$ perl -wle 'sub foo (&$*) { print "@_"; } foo(sub {*STDOUT},"a", "b");' | |
CODE(0x2561da8) a b | |
$ perl -wle 'sub foo (&$*) { print "@_"; } foo {*STDOUT} "a", "b";' | |
CODE(0x184ed68) a b | |
# How can I from inside the sub distinguish the calls? | |
# print example: | |
$ perl -wle 'print sub{*STDOUT},"a", "b";' | |
CODE(0x1a78d70)ab | |
$ perl -wle 'print {*STDOUT} "a", "b";' | |
ab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment