use Getopt::Long; use strict; use vars qw/@opt_id/; GetOptions("id=s@"); print join "|", @opt_id;