Here are two solutions and the problem.
cheako@arcadia:~$ perl
warn unpack("B620",pack(
'B8 C3 N10 B32',
'00100011',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1425691777,
761152,
'0',
'0',
1425691777,
761152
));
00100011000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
00000000000010111001110101000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
10111000000000000000000000000000 at - line 1.
Different output, but identical input :/.
cheako@arcadia:~$ perl
warn unpack("B620",pack(
'B8 C3 N11',
'00100011',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1425691777,
761152,
'0',
'0',
1425691777,
761152
));
cheako@arcadia:~$ perl
warn unpack("B620",pack(
'B8 C3 N11',
'00100011',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1425691777,
761152,
'0',
'0',
1425691777,
761152
));
00100011000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
00000000000010111001110101000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
00000000000010111001110101000000 at - line 1.
cheako@arcadia:~$ perl
warn unpack("B620",pack(
'B8 C3 N10 B32',
'00100011',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1425691777,
761152,
'0',
'0',
1425691777,
'00000000000010111001110101000000'
));
00100011000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
00000000000010111001110101000000
00000000000000000000000000000000
00000000000000000000000000000000
01010100111110100101010010000001
00000000000010111001110101000000 at - line 1.
I've a lot of experience with pack and unpack and every time I learn something new, seems they never behave the way one would think they should. Check it with a warn unpack("B384",$send_sntp_packet) the best thing you can do at times like this is add in warn every branch.
my@argsforpacksend_sntp_packet=($client_li_vm_mode ,
+ $client_stratum , $client_poll , $client_precision , $client_root_de
+lay , $client_dispersion , $client_reference_identifier , $client_ref
+erence_timestamp_sec , $client_reference_timestamp_microsec , $client
+_originate_timestamp_sec , $client_originate_timestamp_microsec , $cl
+ient_receive_timestamp_sec , $client_receive_timestamp_microsec , $cl
+ient_transmit_sec , $client_transmit_microsec); warn Dumper \@argsfo
+rpacksend_sntp_packet;
my $send_sntp_packet = pack "B8 C3 N10 B32", @argsforpacksend_sntp_p
+acket;
warn unpack("B384",$send_sntp_packet)
Wrap each call to pack/unpack like this and you'll see what's wrong.