Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Performing addition on hex value extracted from a string

by haukex (Archbishop)
on Feb 21, 2019 at 10:49 UTC ( [id://1230296]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $line1 =~ /addr:([a-z0-9-]+)\s+/;
    my $one = $num + hex $1;
    $one = sprintf "0x%x", $one;
    $line1 =~ s/addr\:0x.*qospri/addr\:$one qospri/;
    
  2. or download this
    $line1 =~ s{ addr:0x \K ([0-9a-fA-F]*) (?=\s+qospri) }
        { sprintf "%x", hex($1)+$num }xe;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1230296]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found