Storing Substitution Output Stringby bob (Novice)
|on Jul 14, 2002 at 17:37 UTC||Need Help??|
bob has asked for the
wisdom of the Perl Monks concerning the following question:
I have a script that calls down an xml file from the web. The file has lots of content, but I only want certain stuff. I use a substitute expression to change that pattern of content into html... Like so.... (simplified example)
$page2 =~ s/<title>(.*)<\/title>/<li>A$1C</li>/gi;
However, when I go to write out $page2 to a file, the substitution output is there all right, and fine, but the saved data also includes everything else in the original file too; in other words, all the material which didn't match the substitution pattern.
I want to be able to save just the string resulting from the substitution. This sounds like it ought to be a simple thing to me, but I've sought the answer for days without luck.
Thanks in advance, of course....