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