EDIT: I think I finally understand the question:
, , - , . . . (.. "\n\n"). OP ( ).
( ). , , . , , script . , , .
use strict;
use warnings;
while (
defined(my $q = read_statement(\*DATA))
and defined(my $a = read_statement(\*DATA))
) {
print "QUESTION: $q\nANSWER: $a\n\n";
}
sub read_statement {
my ($fh) = @_;
my $line;
while ( $line = <$fh> ) {
last if $line =~ /^"/;
}
return unless defined $line;
return $line if $line =~ /"$/;
my $statement = $line;
while ($line = <$fh> ) {
$statement .= $line;
last if $line =~ /"$/;
}
return unless $statement =~ /"$/;
return $statement;
}
:
__DATA__
"Hi how are you?"
"Hello
im
fine, thank you!"
"How is the weather?"
"It rained
all week.
It been
gray
and cold since the 15th"
"Who are you?"
Sinan
:
C:\Temp> t
QUESTION: "Hi how are you?"
ANSWER: "Hello
im
fine, thank you!"
QUESTION: "How is the weather?"
ANSWER: "It rained
all week.
It been
gray
and cold since the 15th"