Hi all,
I need to do a very simple replace on a piece of text but the problem is first of all my code needs to find the required string then based on that string look up an id in a database and then replace the string with the following url:
# where $id is from the db.
This is what I have so far (assume all variables are already initialized to a text file):
foreach (@data) {
if ( m/stringtofind/gi ) {
$string_id{$&} = process_string($&);
}
}
process_string simply takes the string looks it up in the db and returns the id. At this point I need some help ... not sure how to replace the stringtofind with the above url. If i do s/stringtofind/ nothing happens, maybe the $_ variable needs to be reset but I cant find out how.
Thanks for any help!
I need to do a very simple replace on a piece of text but the problem is first of all my code needs to find the required string then based on that string look up an id in a database and then replace the string with the following url:
# where $id is from the db.
This is what I have so far (assume all variables are already initialized to a text file):
foreach (@data) {
if ( m/stringtofind/gi ) {
$string_id{$&} = process_string($&);
}
}
process_string simply takes the string looks it up in the db and returns the id. At this point I need some help ... not sure how to replace the stringtofind with the above url. If i do s/stringtofind/ nothing happens, maybe the $_ variable needs to be reset but I cant find out how.
Thanks for any help!