-1

My question is: I have something like this in my code

my $offset  = ‘0x4’

Out of this I want to extract only the value 4 and store it in a variable and discard ‘0x’, how can I do it.

Please note that this is just an example the values will keep changing so I want an generic way to do it.

Thanks.

v010dya
  • 5,296
  • 7
  • 28
  • 48

1 Answers1

-1

You can do it in many ways in Perl 1. You can use regex 2. You can use subsrting 3. You can even split on basis of x. If it is a Hex value u can use Bit::Vector to convert to Decimal Value

Sagar
  • 15
  • 4