in reply to Getopt::Long subroutine question

You can't use a sub reference like that if your desire is for it to receive all the parameters at once. Here is an alternative:

use strict; use warnings; use Getopt::Long; my @test; GetOptions( 'test=s{3}' => \@test ); sub sub1 { print "@_" }; sub1 @test if @test;