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-

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 --

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(