Advertisement
happy-barney

local sub

May 25th, 2020
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.20 KB | None | 0 0
  1. # Idea
  2. sub foo { say "foo" }
  3. foo;
  4. {
  5.     local sub foo { say "blah" };
  6.     foo;
  7. }
  8. foo;
  9.  
  10. # Current
  11. sub foo { say "foo" }
  12. {
  13.     sub foo;
  14.     local *foo = subname foo => sub { say "blah" };
  15.     foo;
  16. }
  17. foo;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement