[Za-pm] Re: perldoc
Spike
spikeh at mweb.co.za
Thu Jun 5 09:09:23 CDT 2003
I had some agro trying to do it with getopt (tried to interpret h e l p as
args)
so:
getopts("hDd:f:t:", \%args)
|| exec('perldoc', $0); # perldoc if bad args
(keys %args) || exec('perldoc', $0); #perldog if no args
At 2003/06/05 03:30 PM, Sean Carte wrote:
>On Thu, 2003-06-05 at 15:25, Nick Cleaton wrote:
> > On Thu, Jun 05, 2003 at 02:40:52PM +0200, Sean Carte wrote:
> > >
> > > if ( $ARGV[0] and ( $ARGV[0] eq '--help' ) ) {
> > ^^^^^^^^^^^^
> > > exec('perldoc', $0);
> > > }
> >
> > To prevent a warning if there are no arguments, right ?
>
>Exactly.
>
> > How about replacing those 3 lines with:
> >
> > exec 'perldoc', $0 if "@ARGV" eq '--help';
>
>Nice. But I'll keep my warning prevention:
>
>exec 'perldoc', $0 if ( $ARGV[0] and ( $ARGV[0] eq '--help' ) );
>
>--
>Regards
>Sean Carte
>
>University of Zululand
>Network Services Unit
>Phone: 035 902 6081
>Fax: 035 902 6028
>
>"Always look on the bright side of life..."
>
>_______________________________________________
>Za-pm mailing list
>Za-pm at mail.pm.org
>http://mail.pm.org/mailman/listinfo/za-pm
Spike Hodge
UNIX Programmer
M-Web Technology
021 596 8496
082 901 5265
Click here and make M-Web your homepage
http://homepage.mweb.co.za
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/za-pm/attachments/20030605/599ce848/attachment.htm
More information about the Za-pm
mailing list