Hi everybody, i have a problem, i have to write a perl script to translate binar numbers to decimal and hex and the same back. All I know is, that i have to use Operators like OR, XOR, AND, NOR... also mod, switch It isn't allowed to use pack and sprintf. Well the problem is, that i have no programming skills. I know that e.g. Hex 1A2 is in Decimal 418 because i have to calulate like that 2x1 = 2 + 10x16= 160 + 1x256= 256 ----------------------- 418 Decimal in binar e.g. Dec 40 = 101000 because 40/2 =20 left 0 20/2 =10 left 0 10/2= 5 left 0 5/2 =2 left 1 2/2 =1 left 0 1/2 =0 left 1 ------------------------------ 101000 and i also know that bin. in dec is e.g.bin 1010 is dec10 because 1x1² =1 + 0x2²= 0 + 1x3²= 9 + 0x4² =0 ------------------ 10 So but know i don't know how to write an Perl script with all these infos . Please help Thx rini
Check out the link below for a quick 'n easy demo of what you're wanting to do. http://www.jb.man.ac.uk/~slowe/perl/binary.html