On Sep 3, John Edwards said:

>unless ( $status == (1 || 2) ) {
>        print "\nport status must be either up or down\n\n";
>        exit;
>} else {
>       system("/usr/bin/snmpset hostname password
>interfaces.ifTable.ifEntry.ifAdminStatus.$port i $status");
>}
>
>The above says "unless status equals 1 or 2, fail", which is what you need.

Err, not really.  It says:

  "unless $status equals (1 or 2)"

which is

  "unless $status equals 1"

The operators aren't distributive like that.  You have to write

  unless ($x == 1 or $x == 2) {

instead of

  unless ($x == (1 or 2)) {

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to