1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#! /usr/bin/perl use strict; use warnings; use Getopt::Long; ### MAIN my $call_external_program = 0; GetOptions( 'extern' => \$call_external_program, ) or exit 127; if ( $call_external_program ) { # if option was set to execute external program, do that and terminate this script # provide rest of @ARGV to the external program exec( "external_program", @ARGV ); } ### else do some other stuff