home *** CD-ROM | disk | FTP | other *** search
- Organization: Sponsored account, Chemical Engineering, Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!mailgzrz.TU-Berlin.DE!math.fu-berlin.de!ira.uka.de!yale.edu!spool.mu.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!tm8t+
- Newsgroups: comp.lang.perl
- Message-ID: <EfNK=9q00YUnF7ZUdI@andrew.cmu.edu>
- Date: Tue, 26 Jan 1993 11:11:53 -0500
- From: Tod McQuillin <tm8t+@andrew.cmu.edu>
- Subject: Re: How to convert string to hex?
- In-Reply-To: <C1Fs2F.BB3@ibeam.intel.com>
- References: <C1FnMG.AMB@ibeam.intel.com>
- <C1Fs2F.BB3@ibeam.intel.com>
- Lines: 13
-
- gweil@ibeam.intel.com (Garry Weil) writes:
- > gweil@ibeam.intel.com (Garry Weil) writes:
- >
- > >How do I convert "Test" to 0x54 0x65 0x73 0x74 ?
- >
- > BTW, I want to separate hex values with ",".
-
- How about this:
-
- $arg = $ARGV[0];
- print join(", ", grep($_=sprintf("0x%x", ord $_), split(//, $arg))),"\n";
-
- Works for me.
-