Try this: use strict; use warnings; my $mac="00:14:85:50:A3:CF"; my @mac_address_fields = split(/:/,$mac); foreach my $field (@mac_address_fields) { $field = chr(hex($field)); } my $final_mac = join("", @mac_address_fields);
You now have the mac address in the appropriate format (I presume you are using SNMP to program it onto a device.) Regards, Leigh Leigh Sharpe Network Systems Engineer Pacific Wireless Ph +61 3 9584 8966 Mob 0408 009 502 email [EMAIL PROTECTED] web www.pacificwireless.com.au -----Original Message----- From: SolHai Haile [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 19, 2006 10:25 AM To: perl-win32-users@listserv.ActiveState.com Subject: Some Help please Hi All, I need to read mac address and program into a device: Example: my @mac = "00:14:85:50:A3:CF"; while (<@mac>) { my ($oct0,$oct1,$oct2,$oct3,$oct4,$oct5) = split /:/,$_; } 1. How do I convert $oct0..$oct5 to hex $oct0 = 0x00, $oct1=0x14, .., $oct5 = 0xcf The problem is I need to increment $oct5 by 1 and by 2 to have another two mac addresses. 2. Is my approch correct? I appreciate for your help. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs