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
>
>
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
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-
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
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
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
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
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
>
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
--
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
>
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
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
--- 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
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
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
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(
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') #
17 matches
Mail list logo