Hey David,

My MUA believes you used Microsoft Outlook, Build 10.0.2627
to write the following on Monday, March 18, 2002 at 4:22:02 PM.
>>   1. How do I brake the MAC Address up into bytes?

DG> I'm not exactly sure what format you're getting the MAC address in, but
DG> it looks like you're just splitting it into two-character chunks... To
DG> split that, you could do:

DG> my $c = 0;
DG> while($mac =~ /(.{2})/g){
DG>   $mac[$c++] = $1;
DG> }

>>   2. How to convert to binary and put it in a variable?  I think I
>>   have seen sprintf to convert, but how to get that into the var...

DG> perldoc perlfunc | grep binmode

>>   3. Then how to convert back to hex?

DG> To convert to hex, you can use the aptly named hex() function, and check
DG> out perldoc -f sprintf using the %d option to convert to decimal (or %x
DG> to hexadecimal).

DG> Hope that helped a bit, please provide more specific info if I'm
DG> misunderstanding your questions.

DG>  -dave


Thanks Dave!  That got me a long way.  Now I just need to know how to
reverse the order of the bits...

Input = 01000000
Output= 00000010

btw, this is what I have now:
 #!perl -w
 use strict;
 use diagnostics;

 my (@mac);
 my $mac = "4000 0000 0001";
 $mac =~ s/\s//g;
 my $i = 0;
 while($mac =~ /(.{2})/g){
         $mac[$i++] = $1;
         my $str = unpack("B32", pack("H", $1));
         print $1 . " - " . "$str\n";
 }
 print "\n@mac\n";

-- 
[EMAIL PROTECTED]
MUA = TB! v1.53d (www.RitLabs.com/The_Bat)
Windows NT 5.0.2195 (Service Pack 2)
I have an imaginary friend who refuses to play with me.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to