Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Scripting >> Perl >> How to build usage display and parse options using forward slash /

use File::Basename; $prog = basename(replacebegin:content:replaceend); %Bytes; # eg. $Bytes{'01'} etc %Jobs; # eg. $Jobs{'01'} etc if($#ARGV < 2) { die "\nUsage:\n\n\ $prog /s=dd-mmm-yyyy /e=dd-mmm-yyyy /f=text|html /o=outfile \n\n /s\tstart date\n /e\tend date\n /f\toutput format either text or html\n /o\toutput file name\n"; } for($hr=0;$hr<24;$hr++) { $Bytes{"$hr"} = 0; $Jobs{"$hr"} = 0; } foreach $a (@ARGV) { $a =~ s/^\///gi; ($argname,$argval) = split(/=/,$a); $inputarg{$argname} = $argval; } if ( defined $inputarg{'s'} ) { printf "start date = %s\n",$inputarg{'s'}; } if ( defined $inputarg{'e'} ) { printf "end date = %s\n",$inputarg{'e'}; } if ( defined $inputarg{'f'} ) { printf "report format = %s\n",$inputarg{'f'}; } if ( defined $inputarg{'o'} ) { printf "output file = %s\n",$inputarg{'o'}; }
[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]