On Tue, 2004-04-20 at 11:30, Bob Bell wrote: > Can you share code? I don't see why you'd have a problem. > > $ perl -pe '$tag="MyTag";s/::tag/$tag/g;' <<< "foo ::tag ::other" > foo MyTag ::other
Sure... I think I didn't make the request totally clear anyway... (BTW, this is part of a trouble ticketing system, in case that helps the mindset). Here are some relevant bits: &GetOrderData(cust_id); ## this line pulls about 50 variables from a data base linked to the row which matched cust_id. ## In this subroutine, if you are not opening a "trouble" ticket, then you must be using a ticket template... if ($subtype ne 'trouble') { ## we're basically pulling 2 items out of a template database to craft an email. ## subtype is defined elsewhere, which would be things like "spamalert", "circuitdown", etc... $sth = $dbh->prepare ( "select subject, message from TicketTemplate where menuItem = '$subtype'"); $sth->execute(); $sth->bind_columns(\$template_subj, \$template_message); $sth->fetch(); $sth->finish(); ## Okay, so now we have $template_subj and $template_message populated. $template_message contains these double-colon tags that I want to replace... $template_message =~ s/::(\w+)/\$$1/g; ## the above line is sort of what I am trying to accomplish. replace all double-colon words with the value of their equivalent variable $template_message =~ s/::company/$company/g; ## I could do that ^^ for each variable, but it's cumbersome, and as new variables are added I have to go back and update the code, and it seems kludgy to have 50 iterations of the above line. $sentdesc = $template_subj; $sentnotes = $template_message; } Here is an example: Our monitoring systems have reported a possible ::circuittype circuit down at the following location: ::address, ::city, ::state. If your connectivity appears to be down, please check the power status of the ::routerbrand ::routermodel and reboot it if possible. If you need assistance, you may reply to this ticket with light status or additional information. If we see the connection come back up we will automatically close the ticket. Thank you After running through this code block, the above template would become: Our monitoring systems have reported a possible DSL circuit down at the following location: 12345 Any Street, Your Town, FL. If your connectivity appears to be down, please check the power status of the Cisco 1601 and reboot it if possible. If you need assistance, you may reply to this ticket with light status or additional information. If we see the connection come back up we will automatically close the ticket. Thank you -- brian <[EMAIL PROTECTED]> _______________________________________________ gnhlug-discuss mailing list [EMAIL PROTECTED] http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss