Nishi, Parsing XML with your own logic is cumbersome. However, you can easily parse it using Xml::Parser/Xml::Simple modules.
Here is a sample code using Xml::Simple... use strict; use XML::Simple; my ($parser, $xmldata); $parser = XML::Simple->new(); $xmldata = $parser->XMLin($ARGV[0]); print $xmldata->{'filemap_generic'}, "\n"; Hth, with warm regards, Venkat Saranathan Gulf Breeze Software www.gulfsoft.com GulfBreeze Blog www.gulfsoft.com/blog -----Original Message----- From: Jay Savage [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 10:44 AM To: Nishi Bhonsle; beginners@perl.org Subject: Re: write out filenames of files existing on a filesystem into afile On 7/19/06, Prabu <[EMAIL PROTECTED]> wrote: > Nishi Bhonsle wrote: > > Hi: > > > > How do I look for the string <filemap_generic> in the following file > > so that > > i can insert something between the tags > > <filemap_generic> > > insert some bla text here > > </filemap_generic> > > in the following file? > > > > ---------------------------------------------------------------------------- -------------------- > > > > <?xml version="1.0" encoding="UTF-8"?> > > > > <!DOCTYPE filemap> > > <filemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:noNamespaceSchemaLocation="filemap.xsd"> > > > > <filemap_generic> > > > > </filemap_generic> > > </filemap> > > > Hello Nishi, > > Hope this helps you... > > perl -i.bak -p -e 's#<filemap_generic>#<filemap_generic>insert some bla > text here#i' filename > > -- > Prabu.M.A > When I was born I was so surprised > I didnt talk for a period and half > -Gracie Allen > Nishi, First of all, when you have a new question, start a new thread. Please see the FAQ. The only people who will find this message are people interested file names. Second, parsing structured data with regexes is notoriously tricky. There are hundreds of modules on CPAn to accomplish what you're trying to do. which ones have you tried? Why didn't they work? Again, please see the FAQ or http://www.catb.org/esr/faqs/smart-questions.html. HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>