my @list = qw(some random values); my $text = "bla bla bla"; my $command = sub { $d->checklist( text => $text, list => \@list ); }; my @returnlist = $command->();