in reply to One for the regexp fans
Do MAC addresses always have six sections? If so, you could do something like this:
my $fmt = '%02x' x 6; $mac = sprintf $fmt, map hex, split /\./, $mac;
It's still two lines, but the first is just there so I don't have to type '%02x' six times :)
Oh, and it's not really a regex solution - sorry!
--
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: Re: One for the regexp fans
by merlyn (Sage) on Aug 05, 2000 at 10:06 UTC | |
RE: (2) One for the regexp fans (nnnn:nnnn:nnnn)
by ybiC (Prior) on Aug 04, 2000 at 15:05 UTC | |
by nuance (Hermit) on Aug 04, 2000 at 17:19 UTC | |
RE: Re: One for the regexp fans
by Odud (Pilgrim) on Aug 04, 2000 at 13:43 UTC | |
by Anonymous Monk on May 31, 2001 at 18:52 UTC | |
by Odud (Pilgrim) on Jun 01, 2001 at 15:04 UTC |