Re: base64 to hex conversion

2012-01-16 Thread Igor Dovgiy
Hi Ramprasad, Perhaps... *use MIME::Base64 qw/decode_base64/;* *...* *my $res = unpack('H*', decode_base64($source));* ...will do the trick? ) -- iD 2012/1/16 Ramprasad Prasad > Hello > > what is the best way to convert base64 to hex > > I am currently using > >

base64 to hex conversion

2012-01-16 Thread Ramprasad Prasad
Hello what is the best way to convert base64 to hex I am currently using use NetSDS::Util::Convert qw ( conv_base64_str conv_str_hex); ... my $hex = conv_str_hex(conv_base64_str($b64)); But the NetSDS::Util module seems not so popular , I dont find it installed on most machines, Getting it i

Re: hex conversion

2007-07-18 Thread Tom Phoenix
On 7/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: i have a hex value which needs to be checked if a particular bit is set in that string. You probably want to start with the hex() function, which turns a string like '01AF' into a number. But there are other ways; if it's an arbitrarily-

hex conversion

2007-07-18 Thread venkateshwar
hello all, i have a hex value which needs to be checked if a particular bit is set in that string. for example, i need to check if 12th bit is set. i tried doing mask(0x1000) with my input value i receive, so that only if 12th bit is 1, will the answer be onebut can i do a direct comparison a

Re: Binary to hex conversion

2006-10-18 Thread W.P.Nijhof
divya wrote: I've a file with every line having 32 bits of binary data. I need to convert every line data to hex data. my $binary = '11101010101010101010101010101010'; my $int = unpack("N", pack("B32", substr("0" x 32 . $binary, -32))); my $hex = sprintf("%x", $int ); print $hex; HtH WayPay

Binary to hex conversion

2006-10-18 Thread divya
Hi, I've a file with every line having 32 bits of binary data. I need to convert every line data to hex data. I tried pack(), unpack(). But didnt get desired results. Kindly suggest me a way. Thanks, Divya

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread Offer Kaye
On 4/11/06, John W. Krahn wrote: > > This is probably trivial, but I couldn't find a mention of this > > anywhere - why do the following 2 code lines produce different > > results? > >>perl -e 'printf "%d\n" ,0x_' > > -1 > >>perl -e 'print 0x_ , "\n"' > > 4294967295 > > perldoc perl

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread John W. Krahn
Offer Kaye wrote: > On 4/11/06, John W. Krahn wrote: >>>This is probably trivial, but I couldn't find a mention of this >>>anywhere - why do the following 2 code lines produce different >>>results? perl -e 'printf "%d\n" ,0x_' >>>-1 perl -e 'print 0x_ , "\n"' >>>4294967295 >

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread John W. Krahn
Offer Kaye wrote: > Hi, Hello, > This is probably trivial, but I couldn't find a mention of this > anywhere - why do the following 2 code lines produce different > results? >>perl -e 'printf "%d\n" ,0x_' > -1 >>perl -e 'print 0x_ , "\n"' > 4294967295 perldoc perlnumber John --

hex conversion to dec - print and printf differences

2006-04-11 Thread Offer Kaye
Hi, This is probably trivial, but I couldn't find a mention of this anywhere - why do the following 2 code lines produce different results? > perl -e 'printf "%d\n" ,0x_' -1 > perl -e 'print 0x_ , "\n"' 4294967295 Even stranger: > perl -e 'printf "%d\n" ,0x8000_' -2147483648 >

parsing help (hex conversion, perhaps?)

2002-10-18 Thread shawn_milochik
I have a file which contains some hex data. When I unpack it using "H", it gives me what I want, almost. Original file: rtrates.rtrates Perl Script: rtrates.pl Results: rtrates.out What the results are supposed to look like: rtrates.txt The problem I'm having is that although the first two fi

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
On May 10, Paul Cotter said: >print dtcnvx('Ab c') # gives 41622063 Ohh. Oops. $x = unpack 'H*', 'Ab c'; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer

Re: hex conversion

2001-05-10 Thread Paul
--- Paul Cotter <[EMAIL PROTECTED]> wrote: > From: "Jeff Pinyan" <[EMAIL PROTECTED]> > > On May 10, Paul Cotter said: > > >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will > > > allow me to convert a string in to a string hex equivalent. > > > I dare say, in Perl's little quirks the

Re: hex conversion

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Paul Cotter wrote: > Something like > > print dtcnvx('Ab c') # gives 41622063 Use printf or sprintf and %x in your format string to convert something to a hex value. -- Brett The important thing

Re: hex conversion

2001-05-10 Thread Paul Cotter
From: "Jeff Pinyan" <[EMAIL PROTECTED]> > On May 10, Paul Cotter said: > > >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me > >to convert a string in to a string hex equivalent. I dare say, in Perl's > >little quirks there is an arcane subroutine called something like d

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
On May 10, Paul Cotter said: >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me >to convert a string in to a string hex equivalent. I dare say, in Perl's >little quirks there is an arcane subroutine called something like dtcnvx >that does just what I want... Sadly, the oct(

hex conversion

2001-05-10 Thread Paul Cotter
Hi What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me to convert a string in to a string hex equivalent. I dare say, in Perl's little quirks there is an arcane subroutine called something like dtcnvx that does just what I want... Something like print dtcnvx('Ab c') #