use warnings; use strict; use Getopt::Long; GetOptions('test=s{3}'=>\&sub1); sub sub1{ print $_[1]; }