How to convert from string to hex number
- From: dinesh_rmn@xxxxxxxxx (Dinesh)
- Date: Thu, 16 Aug 2007 23:53:46 -0700
Hello,
I have a requirement for passing a hex value like this to a function.
Example code:
my $ipmbAddress = getIpmbAddress(...); ## returns 82
getDeviceID($ip, $ipmbAddress);
Here in the above code, the getDeviceID() fucntion will accept only
0x82 (hex number). How to convert the number 82 to 0x82 (Note that
this should not be as string)
I tried the following but not working properly.
$ipmbAddress = "0x".$ipmbAddress;
$ipmbAddress = hex("$ipmbAddress");
$ipmbAddress = sprintf(0x%0x, $ipmbAddress);
getDeviceID($ip, $ipmbAddress);
Please help.
Thanks,
DineshK
===========
.
- Follow-Ups:
- Re: How to convert from string to hex number
- From: Gunnar Hjalmarsson
- Re: How to convert from string to hex number
- Prev by Date: Re: How to open a file in a folder but without knowing its name
- Next by Date: Re: Read Content Of External File with PERL
- Previous by thread: File::Find help
- Next by thread: Re: How to convert from string to hex number
- Index(es):
Relevant Pages
|