Help for this page

Select Code to Download


  1. or download this
    my $x = '255.0.0.0';
    print "$x is a valid mask!\n" if validateMask($x);
    ...
      return 1;                             # return 1 if everything is ok
    +ay
    }
    
  2. or download this
    11111111000000000000000000000000 is a valid mask!
    
  3. or download this
    print "255.0.0.0 is a valid mask!\n" if validateMask('255.0.0.0');
    
  4. or download this
    Modification of a read-only value attempted at ./idnopheq.pl line 5.
    
  5. or download this
    my $mask = shift;
    
  6. or download this
    sub validateMask {
      $_ = shift;
      return unless /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
      unpack('B32', pack('C4', split /\./)) =~ /01/ ? undef : 1;
    }