This gives the following correct output:
$VAR1 = ['This is a test.','This is a multiline test.']
Not on my perl. Here it gives:
$VAR1 = ['This is a test.
','
This is a multiline
test.
'];
As it's hard to know from that what you actually want, here's an SSCCE which preserves the multi-line nature of the second string but removes the trailling newlines. You can amend it to suit your actual requirements.
use strict;
use warnings;
use Test::More tests => 1;
my @data;
my @want = ('This is a test.', "This is a multiline\ntest.");
{
local $/ = "\nXXX\n";
chomp (@data = <DATA>);
}
is_deeply (\@data, \@want);
__DATA__
This is a test.
XXX
This is a multiline
test.
XXX