View::Value->new({ name => 'create_key', opt_spec => [qw( host=s #few more values )], db_connection => [qw/ hello /], handler => sub { foo (@_) }, }); sub foo { my @opt = View::Value::get_opt; my %handler_for = ( host => sub { create(@_) }, #few more key, value pair ); sub create { my %opt = @_; # Assume that $key has the public key for my $host (split /,/, $opt{host}) { system qq{cat $key | ssh -q $host 'umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/keys'} } return; }