#### INSPECTOR OF ARGUMENTS $ cat inspect_args.sh #! /bin/bash echo "expect $# lines:" echo "----------------" I=1 for ARG in "$@"; do echo "$I: >$ARG<" I=$[I+1] done $ ### CALLER OF INSPECTOR WITH ARGUMENTS $ cat perl_exec.pl #! /usr/bin/perl use strict; use warnings; # https://www.perl-community.de/bat/poard/thread/18171 my $program = './inspect_args.sh'; my @arguments = ( 'foo', 'bar', 'hello world', ); exec( $program, @arguments, ) or die "exec failed: $!\n"; __END__ $ ### LET THEM DO THEIR JOBS $ perl perl_exec.pl expect 3 lines: ---------------- 1: >foo< 2: >bar< 3: >hello world< $