sub spawn_proc_prog { my ($r, $command, $argv) = @_; # to access the elements of $argv you do my $first = $argv->[0]; my $second = $argv->[1]; # or my @argv = @{$argv}; # and there's a lot more..