(@_@) you are not using Getopt::Long yet??? I see that many people has pointed you in the direction of Getopt::Long. I will post one of the templates that I use when writing a new application in Perl.

#!/usr/bin/perl -w # My Perl Application # $Id$ # --- # $Log$ use Getopt::Long; use Pod::Usage; # recommended to use together with Getopt use strict; use vars qw($VERSION); $VERSION = sprintf( '%d.%02d', q$Revision$ =~ /(\d+)\.(\d+)/ ); # Parse command line arguments and assign corresponding variables # Arguments can be put into hash, array of scalar GetOptions ( 'i|in=s' => \( my @file_in = () ), 'o|out=s' => \( my $file_out = undef ), 'define=s' => \( my %defines = () ), 'verbose' => \( my $verbose = 0 ), 'version' => sub { die "$VERSION" }, 'quiet' => sub { $verbose = 0 } ); unless ( $#file_in > 0 && defined $file_out ) { pod2usage( -exitval => 1, -output => \*STDERR ); } # Beginning of application code .... __END__ =pod =head1 NAME application.pl =head1 SYNOPSIS application.pl [options] =head1 ARGUMENTS Arguments to this script are mandatory. =over 4 =item B<-i|--in [file]> Specify an input data file for report extraction. =item B<-o|--out [file]> Specify the output file name for the report. =back =cut
In the above example, you can pass in multiple values of -i option with -i f1 -i f2 -i f3, etc.

You can also pass in, say, -o "o1,o2,o3" and then do

@output_files = split /,/, $file_out;



In reply to Re: parsing arguments by Roger
in thread parsing arguments by mifflin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.