Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have a variable that contains, for example, the following:
"5.ae.20.b.1c.7" (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: "05ae200b1c07" 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. Odud In reply to One for the regexp fans by Odud
|
|