Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: search and replace desired portion from a line

by thanos1983 (Parson)
on May 29, 2019 at 08:42 UTC ( #11100688=note: print w/replies, xml ) Need Help??

in reply to search and replace desired portion from a line

Hello syedasadali95,

I suppose you want to match any single integer from 0-9 after addr:0x*? If this is the case why not simply like:

$line1 =~ s/addr:0x[0-9]/addr:$address/;

Also there is no need to escape semicolon character. :)

Update: Fellow Monk AnomalousMonk has a point. This is the more correct solution $line1 =~ s/addr:0x[[:xdigit:]]+/addr:$address/;. Since this a hex value and not just a digit.

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^2: search and replace desired portion from a line
by syedasadali95 (Acolyte) on May 30, 2019 at 07:03 UTC

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2020-05-28 21:49 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (166 votes). Check out past polls.