Hello,
Where did you come up with 
        $pub =~ if (/<pub>/i .. /<\/pub>/i ) 
I guess you want to get the sting between the <pub> </pub> tags, but that's not
how it's done.
You can do 
        push @pub, m#<pub>(.*?)</pub>#g; #it's better with an array
but that would break if you have the <pub> and </pub> on separate lines. 
Basically, you cannot parse an XML file with one regexp.  Take a look at the
XML::Parser module or friends.

Hope this helps.


On Sat, 30 Jun 2001 13:05:15 +0200, Morgan said:
> Hi
>  
>  Can someone help me out with a simple question?
>  I need to match some parts if a document. and store it in variables so
>  I can send the matching string into more than one new file.
>  RegExp
>  --------------------
>  while (<>) {
>  $pub =~ if (/<pub>/i .. /<\/pub>/i )       # or is it better with an
>  array or hash?
>  }
>  open (DOC, ">$newfile" or die$!;
>  print DOC $pub;
>  close (DOC) or die $!;
>  
>  open (FILE, ">$new" or die $!;
>  print FILE $pub;
>  close (FILE);
>  ----------------------
>  
>  I can't get it to work.
>  Am I on the trail or have I just lost it :)



Reply via email to