hex() takes a string argument, so due to weak Perl input, it will read the argument as the string you pass.
The first passes 0x30as a string, which is hex()then converted directly to decimal.
0x30, 48 , hex(), 72. hex(hex("0x30")).
hex("0x30").
$ perl -e 'print 0x30';
48
$ perl -e 'print hex(0x30)';
72
$ perl -e 'print hex(30)';
48
$ perl -e 'print hex("0x30")';
48
$ perl -e 'print hex(hex(30))';
72