(Solved):Write a program to convert a binary number specified as argument to decimal in PERL language. (Hint: Use the reverse function.) View Answer…

 

Question

Write a program to convert a binary number specified as argument to decimal in PERL language. (Hint: Use the reverse function.)

 

EXPERT ANSWER

To convert a text string of ones and zeros to a Perl integer, first massage the string by padding it with the right number of zeros, first pack the binary number into a number in network byte order (the ” N ” format), then unpack it again one by

Scroll to top