How can I extract the following value, 0xF and 9.
$line="This is a hexadecimal number 0xF";
$line="This is a hexadecimal number 9";
I want to be able to extract 0xF and 9 via pattern matching even though the 9 does not have a 0x in front of it.
I would like to be able to store the hexadecimal number in a perl variable such as $1.
Maybe something like this:
$line=~/This is a hexadecimal number (?)/;
print "The hexadecimal number is $1;