in reply to Bit operation

1.

Yes.

2.

my ($hex) = $string =~ /\b(0x[0-9a-fA-F]+)\b/;

(then do hex($hex) if you want the value as a number)