in reply to I still can't get only the necessary lines from the file.

One problem is your regexp. Here's what it is saying:

Match if:

  1. Match "START context"
  2. or
  3. * is a quantifier, and can't be used as a bare character without escaping it. In the context of |*, I have no idea how it's going to be interpreted, but it won't be how you think.
  4. Match "End context"
  5. Match any amount of trailing space characters (because you used * again, which is a quantifier).

The "print unless..." statement should be as follows:

print unless ( /START context/ or /\* End context \*/ );

Another solution might be like this:

{ local $/ = "* End Context *\n"; while ( <DATA> ) { s/^START context//; my @info = split /\n/; chomp @info; print "$_\n" foreach @info }

Dave