Loading ...
Sorry, an error occurred while loading the content.

SOLVED: [PBML] Need help with doing a procedure in reverse

Expand Messages
  • Bobby Jafari
    ... sprintf ( %.2d:%.2d ,ord(substr($hexMAC},0,1)),ord(substr($hexMAC,1,1)));
    Message 1 of 3 , Oct 2, 2006
    • 0 Attachment
      > ord() is basically the reverse of chr(). You could use
      > sprintf() to format a decimal value into a hexadecimal value.
      > See perlfaq4: How do I convert between numeric
      > representations/bases/radixes?

      > Joining these values into a colon denominated string
      > shouldn't present too tough a problem. To split a string
      > into two character sections you might use this.

      > my @machine = $hexMAC =~ /(..)/g;

      sprintf
      ("%.2d:%.2d",ord(substr($hexMAC},0,1)),ord(substr($hexMAC,1,1)));
    Your message has been successfully submitted and would be delivered to recipients shortly.