Just to add the comment that even if you arent using a hash, you can have default values witrh Getopt::Long - heres a snippet from some code I'm writing right now
...
use Getopt::Long;
use Pod::Usage;
...
GetOptions(
'd|dir=s' => \( my $outDir = '.' ),
'f|file=s' => \( my $inFile ),
'l|log=s' => \( my $logFile = './tu_log.conf' ),
);
unless ( $inFile ) {
pod2usage( -exitval => 1, -output => \*STDERR );
}
...
__END__
=pod
=head1 NAME
Retail_PickList_Generator.pl - generate picklists for outstanding
+Retail orders.
=head1 SYNOPSIS
Retail_PickList_Generator.pl --file <incoming retail order file> [
+--log <log config file> --dir <directory to write picklists to>]
=cut
With the defaults, I only need supply the inward file name. And I get more specialised behaviour by passing in --dir or --log as required...
...it is better to be approximately right than precisely wrong. - Warren Buffet
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.