"Manish Uskaikar" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] command line:
$perl man.pl manish perl script #!/usr/bin/perl; ($inputfile) = @ARGS; Could anyone tell me how to accept the commandline parametes this does not seem to work. for simple arguments this works great. If you want to parse complex command line arguments, use Getopt::Long.This module comes with perl. Heres an example: my $opts = { }; GetOptions( $opts => qw/directory=s loglevel=s/); my $missing = [ ]; foreach my $option ( qw/directory loglevel/ ) { push( @{ $missing }, $option ) unless ( $opts->{ $option } ); } usage( $missing ) if ( @{ $missing } ); sub usage { my $args = shift; my $usage; $usage = join("", map("missing required parameter: '$_'\n", @{ $args }), "\n" ); $usage .= 'Usage: $ ' . $0 . ' \\' . "\n"; $usage .= ' --directory=/path/to/zip/files \\' . "\n"; $usage .= ' --loglevel=[DEBUG|INFO|WARN|ERROR|FATAL]' . "\n\n"; die( $usage ); } Enjoy, Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>