undef $/; open(IN, "d:\\xyz.txt") || die "Cannot open file\n"; $str = ; if ($str =~ m#(.*?)\n\n#gsi) { $a=$1; } print $a;