Thread MAC Adresse formatieren (4 answers)
Opened by puemer at 2011-11-18 17:16

murphy
 2011-11-18 17:34
#154315 #154315
User since
2004-07-19
1776 Artikel
HausmeisterIn
[Homepage]
user image
Das geht zum Beispiel so:
Code (perl): (dl )
my $pretty_mac = join('-', map { sprintf('%02x', hex($_)) } split(/-/, $mac))


Edit: Oder auch so:
Code (perl): (dl )
my $pretty_mac = ($mac =~ s/(^|-)([[:xdigit:]]+)/sprintf("%s%02s", $1, $2)/gre);

Last edited: 2011-11-18 17:40:46 +0100 (CET)
When C++ is your hammer, every problem looks like your thumb.

View full thread MAC Adresse formatieren