http://qs1969.pair.com?node_id=780349


in reply to Transforming a scalar to an array

I realize that local( $/, *INPUT ); gets rid of the new lines.

It doesn't actually. You end up with a scalar that still has a newline at the end of each line of text. You can, of course, use that to your advantage.

my @lines = split /\n/, $input;
--

See the Copyright notice on my home node.

Perl training courses

Replies are listed 'Best First'.
Re^2: Transforming a scalar to an array
by ikegami (Patriarch) on Jul 15, 2009 at 15:19 UTC
    That's different from <> in that it will trim trailing blank lines (which is probably fine) and chomp all lines (which is probably fine).