In article <057501c1b305$6a15b360$[EMAIL PROTECTED]> wrote "J. Raj Mohan"
<[EMAIL PROTECTED]>:

> Hi Andrea,
> 
> Thanks for responding my mail.
> 
> Actually I want to read(store it into a string) like; Begin keyword is "<!ATTLIST" 
>and the End
> keyword is ">". By using these two delimiters I like/want to read the file.
> 
> Of the file:-
> <!ATTLIST abbrevList
> id ID #IMPLIED
> linkLabel CDATA #IMPLIED
> role CDATA #IMPLIED
>>
>>
> Pls. help!!!
> Raj.
> 
There are >= two ways to solve:
1. with regexps:

I assume the file is in the variable $text;
my $start = "<!ATTLIST abbrevList";
my $end = ">";
$text =~ /\<!ATTLIST abbrevList\s*
            ([^\>]+)
          \>/x;
my $what_you_want = $1;

2. If the structur of the file is exactly like above,
including all line ends a quicker way is:

my $what_you_want = '';
open FILE, "filename" or die "Cannot open filename: $!";
my $active = 0;
while (<FILE>) {
        chomp;
        if ($_ eq '<!ATTLIST abbrevList') {
                $active = 1;
                next;
        }
        next unless $active;
        $_ eq '>' and last;
        $what_you_want .= "$_\n";
}
close FILE;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to