in reply to Get file part from the section where the matched pattern is found.

But not able to get it.

Hmm, what have you tried to debug the problem?

I see code from Load file into a scalar without File::Slurp but none from Basic debugging checklist

Your code is very short and straight forward ( thus answerable without sample input ... How do I post a question effectively?),

but you already got the answer in: PERL regex modifiers for m//, Regex: Extracting the case insensitive string and printing on the output, how to read a particular paragraph from middle of a file line by line and enter each string in the line as an element of an array

What was the problem with copy/pasting those solutions? Why can't you use capturing parentheses or post match variable, or split ...?

See

  • Comment on Re: Get file part from the section where the matched pattern is found.