Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- use Getopt::Long;
- $l=@ARGV;
- print "The number of args is " . @ARGV;print "\n";
- my $bool= GetOptions('help|?' => \$help, 'url=s' => \$url, 'size=i' => \$size);
- ;
- if ( !$bool or $l < 1 || defined $help ){
- &usage();
- print "=======\n";
- print "THE END";
- {
- if (@_ ){
- print "Unknown option: @_\n"}
- print "usage: program [--url URL] [--size SIZE] [--help|-?]\n";
- }
=======
C:\>perld.pl --url www --size 15 -david -fass
The number of args is 6
Unknown option: david
Unknown option: fass
usage: program [--url URL] [--size SIZE] [--help|-?]
=======
please explain why the "additional arguments of perld.pl" are passed through sub usage() to @_????
but I call to sub usage() without parameters????????!!!!!!!!!