use strict; use warnings; use Test::More tests => 1; my $have = 'foo bar'; my $want = 'foobar'; $have =~ s/\n//; is $have, $want; my @data=split(/\n//); foreach my $have (@data) { $want = $have; }