in reply to Re^2: matching everything between over two lines
in thread matching everything between over two lines

your code appears to only read the first line of the file. Try my $str=join("",<FG>); instead of the second line.
  • Comment on Re^3: matching everything between over two lines