But how can can i convert $QTYPE=23 to the hexa value of 2 octets which is '0023'
Wrong question.
You need to learn how to store 2316 into $QTYPE. Right now, you are storing 2310, a completely different number.
$QTYPE = 0x23; # 35
If you're starting with a string, you can use hex or oct.
$QTYPE = hex('23'); # 35 $QTYPE = oct('0x23'); # 35
So is there any function in perl which directly convert the domain name into the required hexa format
There's no builtin function. I've specified the format (from which a solution is easily derived using split, length, and pack 'C') in an earlier post. Furthermore, someone gave you the name of a module that supposedly does the work for you.
In reply to Re^3: How to create a DNS message in perl?
by ikegami
in thread How to create a DNS message in perl?
by sanjay nayak
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |