my $foo; $_ = "She sells sea shells by the sea shore"; { local $\ = $/; open my $fh, '>', \$foo; print $fh $_ for split; } print $foo;