Skip to content

Instantly share code, notes, and snippets.

@moritz
Created May 26, 2012 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/2793547 to your computer and use it in GitHub Desktop.
Save moritz/2793547 to your computer and use it in GitHub Desktop.
workaround for &eval being an only-sub
proto eval(|$) {*};
multi sub eval($str) {
$str.eval;
}
multi sub eval($str, :$lang! where 'perl5') {
'dummy p5 return value';
}
say eval('2 + 2');
say eval('2 + 2', :lang<perl5>);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment