I am trying to become more fluent with perl. I need another set of eyes to look at this. I want to check that the user enters a community string every time and either a single ip or a source file.
Am I missing anything ? Thanks apreeesch the help ...
script cut here
sub dosnmp {
print "cmd line ok eventually do snmp stuff\n";
exit;
}
#
sub err {
print STDERR <<EOF;
Syntax :
dsnmp -c <comm_string> <ip address>
or
dsnmp -c <comm_string> -f <filename>
EOF
exit;
}
#Handle Options
getopt ('fc');
if ($opt_f) {$ifil="$opt_f"};
if ($opt_c) {$rw="$opt_c"};
#
#check that user enters the mandatory RW string
#and a file or single ip.
if (!($rw)) { system ("tput clear"); err; }
#
if (!($ifil)) { $ip = shift; }
#
if (!($ip)) { system ("tput clear"); err; } else { dosnmp; }
#
script cut here