You should read more about this, you can solve it with what is called a RegEx as for Regular Expression:
let's assume you know how to read the lines into an array and iterate over it, all you need to do is substitute s/// the abc into xyz:
ex:
while (<DATA>) {
s/abc/xyz/ig; # The way this is constructed: it takes
# the value in the first set of / / and
# replaces it with the value in the next
# set.
Update: this could chew user abcd@abc.com, so here's a fix
s/\@abc\.com/\@xyz\.com/ig;
}
__DATA__
SMTP-Address: [user@abc.com]
[user-1@abc.com]
[user-2@abc.com]
SMTP-Address: [anotheruser@abc.com]
[anotheruser-1@abc.com]
[anotheruser-2@abc.com]
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.