sub verify_ether($){ my $mac = uc(shift); $mac =~ s/-/:/g; my @octets; if($mac =~ /^[0-9A-F]{12}$/){ $mac = join(':', unpack("A2" x 6, $mac)); }elsif ($mac =~ /^(([0-9A-F]{1,2}?):){5}([0-9A-F]{1,2})$/ ){ @octets = split(/:/, $mac); map { if (length($_)==1) { $_ = "0" . $_ } } @octets; $mac = join(':', @octets); }else{ return undef; } return $mac; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Verify string as ethernet address
by petdance (Parson) on May 30, 2001 at 06:33 UTC | |
Re: Verify string as ethernet address
by suaveant (Parson) on May 30, 2001 at 20:59 UTC | |
by fs (Monk) on May 30, 2001 at 21:52 UTC | |
by Koschei (Monk) on Jun 01, 2001 at 08:05 UTC | |
by suaveant (Parson) on May 30, 2001 at 21:57 UTC |