Skip to content

Instantly share code, notes, and snippets.

@joeheyming
Created February 20, 2014 19:42
Show Gist options
  • Save joeheyming/9121639 to your computer and use it in GitHub Desktop.
Save joeheyming/9121639 to your computer and use it in GitHub Desktop.
example of python and perl named/keyword arguments
# python
def printArgs(*args, **kwargs):
print kwargs
>>> printArgs(a=1, b=2)
{'a': 1, 'b': 2}
# perl
use Data::Dumper;
sub printArgs {
my %args = @_;
print Dumper(\%args);
}
printArgs(a => 1, b => 2)
$VAR1 = {
'a' => 1,
'b' => 2
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment