sub convert { my %arg = @_; my ($from, $to, $thing) = @arg{qw /from to thing/}; ... } #### sub convert { my %arg = @_; my $from = exist $arg{from} ? $arg{from} : 'default'; my $to = exist $arg{to} ? $arg{to} : 'default'; my $thing = exist $arg{thing} ? $arg{thing} : 'default'; ... } #### sub convert { my %arg = (from => 'default', to => 'default', thing => 'default', @_); my ($from, $to, $thing) = @arg{qw /from to thing/}; ... } #### sub convert { my %arg = @_; my $from = $arg{from} || 'default'; my $to = $arg{to} || 'default'; my $thing = $arg{thing} || 'default'; ... } #### sub convert { local @ARGV = @_; GetOptions ('from:s' => \my $from, 'to:s' => \my $to, 'thing:s' => \my $thing); ... }