use Getopt::Long; my %Config = ( timeout_value => 2, log_file => join( "", Win32::GetFullPathName( $0 ) ), ); $Config{log_file} =~ s/[^.]*?$/log/; Getopt::Long::Configure( "prefix_pattern=(-|\/)" ); $Result = GetOptions( \%Config, qw( install|i remove|r timeout_value|t=i log_file|l=s monitor_sub_dirs|s account_id|user=s account_password|pass=s help|?|h ) ); $Config{help} = 1 if( ! $Result || scalar @ARGV ); if( $Config{install} ) { Install(); exit(); } elsif( $Config{remove} ) { Remove(); exit(); } if( $Config{help} ) { Syntax(); exit(); }