On 1/9/12 Mon  Jan 9, 2012  4:08 PM, "Rajeev Prasad" <rp.ne...@yahoo.com>
scribbled:


> i am getting the input value by splitting a string to an array. does split
> function makes the array values character?

No. Split returns an array of elements that are substrings of the string
being split.

> $string = a:b:1:2:0x00D70803:0x00FE3490;
> @myarr=split(/:/,$string);
> 
> my $lpc= join "-", map ord, ( split //, pack "N", $myarr[4] )[ -3 .. -1 ];
> 
> this is throwing error:
> Argument "0x00D70803" isn't numeric in pack at ./pc.converter.pl line 11.
> 
> I also tried to use int() function by specifying    int($myarr[4])  but i
> still get same error.... ??

You want to use the hex function to convert your hex strings into numerical
values. See 'perldoc -f hex'.



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to