|Perl: the Markov chain saw|
One for the regexp fansby Odud (Pilgrim)
|on Aug 04, 2000 at 13:22 UTC||Need Help??|
Odud has asked for the
wisdom of the Perl Monks concerning the following question:
I have a variable that contains, for example, the following:
(If you're curious it represents the MAC address of a LAN card).
What I want to do is to turn it into the following format:
i.e. remove the dots and add leading zeroes where the original was only one hex digit. After some experiments I came up the following snippet:
This works, but I was wondering if there is a neater way - and in particular can it be done in a single statement?
As usual I look forward to everyone's contributions and suggestions.