Hi,
There must be an easier way to convert a basic ascii string to hex. I tried
using ord/chr/unpack/sprintf(%x) combinations and just dug my hole deeper.
I'm not interested in using any additional modules, just straight, "basic"
perl. This works, but exactly elegant:
#!/bin/perl
use strict;
use warnings;
my $str = "some string";
my $hex = unpack('H*', "$str");
my $len = length($hex);
my $start = 0;
print "x'";
while ($start < $len) {
print substr($hex,$start,2);
$start += 2;
}
print "'\n";
Produces:
x'736f6d6520737472696e67'
-Jeff
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]