Created
July 12, 2016 15:55
-
-
Save nicomen/4692394cfb876c9b878f362dfc0740cf to your computer and use it in GitHub Desktop.
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 do I from inside foo distinguish the calls, to treat the first param magically? | |
# 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