Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-10 Thread John W. Krahn
John W. Krahn wrote: You say you found this code "on the net"? It would probably be better as: #!/usr/bin/perl use warnings; use strict; my $decimal_code = shift or die "usage: $0 \n"; my $binary_code = unpack 'B32', pack 'N', $decimal_code; my @itu_code = $binary_code =~ / (\d{3}) (\d{8}) (

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-10 Thread John W. Krahn
John W. Krahn wrote: $!/usr/bin/perl Sorry for the typo. That should be: #!/usr/bin/perl use warnings; use strict; my $decimal_code = shift or die "usage: $0 \n"; my $binary_code = unpack 'B32', pack 'N', $decimal_code; my @itu_code = $binary_code =~ / (\d{3}) (\d{8}) (\d{3}) $ /x; my

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-10 Thread John W. Krahn
Rajeev Prasad wrote: Hello, Hello, I am trying to convert 32 bitx Hex point code to 24 bit (8-8-8) point code. i tried to use below script from net, but due to limited understanding of perl and above script, I was not able to resolve my problem. Can someone please help me resolve my issue?

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread John W. Krahn
Rajeev Prasad wrote: thx, but when i am using it in a script i am getting error, from CLI the same input is recognized as numeric and i get proper output. here it is: You said: "input would be: 32 bit hex value like: 0x00FE3453". i am getting the input value by splitting a string to an arra

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread Jim Gibson
On 1/9/12 Mon Jan 9, 2012 4:08 PM, "Rajeev Prasad" 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:0x

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread Dr.Ruud
On 2012-01-10 01:08, Rajeev Prasad wrote: $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. perl -wl

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread Rajeev Prasad
ction by specifying    int($myarr[4])  but i still get same error ?? From: John W. Krahn To: Perl Beginners Sent: Monday, January 9, 2012 4:57 PM Subject: Re: 32 bitx Hex point code to 24 bit (8-8-8) point code Rajeev Prasad wrote: > Hello John, >

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread John W. Krahn
Rajeev Prasad wrote: Hello John, example from SS7 point codes: input would be: 32 bit hex value like: 0x00FE3453 output expected is 24 bit value (format 8-8-8): 254-52-83 $ perl -le' my $input = 0x00FE3453; print join "-", map ord, ( split //, pack "N", $input )[ -3 .. -1 ]; ' 254-52-83

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread Rajeev Prasad
Hex point code to 24 bit (8-8-8) point code Rajeev Prasad wrote: > > Hello, Hello, > I am trying to convert 32 bitx Hex point code to 24 bit (8-8-8) point > code. What does the input look like and what do you expect the corresponding output to look like? > i tried to use below

Re: 32 bitx Hex point code to 24 bit (8-8-8) point code

2012-01-09 Thread John W. Krahn
Rajeev Prasad wrote: Hello, Hello, I am trying to convert 32 bitx Hex point code to 24 bit (8-8-8) point code. What does the input look like and what do you expect the corresponding output to look like? i tried to use below script from net, but due to limited understanding of perl an