#! /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