home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / perl / 8008 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  730 b 

  1. Path: sparky!uunet!tcsi.com!iat.holonet.net!news.cerf.net!usc!howland.reston.ans.net!spool.mu.edu!olivea!sgigate!sgi!wdl1!wdl39!mab
  2. From: mab@wdl39.wdl.loral.com (Mark A Biggar)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: How to convert string to hex?
  5. Message-ID: <1993Jan27.002650.25531@wdl.loral.com>
  6. Date: 27 Jan 93 00:26:50 GMT
  7. References: <C1FnMG.AMB@ibeam.intel.com>
  8. Sender: news@wdl.loral.com
  9. Organization: Loral Western Development Labs
  10. Lines: 13
  11.  
  12. In article <C1FnMG.AMB@ibeam.intel.com> gweil@ibeam.intel.com (Garry Weil) writes:
  13. >How do I convert "Test" to 0x54 0x65 0x73 0x74 ?
  14. >
  15. >Garry
  16.  
  17. foreach $x (unpack("c*", "Test")) {
  18.     $result .= sprintf("0x%02x ", $x);
  19. }
  20.  
  21. --
  22. Perl's Maternal Uncle
  23. Mark Biggar
  24. mab@wdl1.wdl.loral.com
  25.