in reply to Re: map split vs array split
in thread map split vs array split

thanks for your pointer.. and you r right.. I should read up more on these..
** update ** I acheived what I wanted w/ below code
I ran into this while going through map tutorial and
wanted to see if I can write the same code using w/out map
But you had me realize that I need to get more through with
basic stuff as well as writing clear questions
thanks for all your help guys~
use strict; open (FH, 'foo.txt'); my @lines = <FH>; my @lines1; close FH; foreach (@lines) { chomp; push my @lines1, $_; } print "@lines1\n";

Replies are listed 'Best First'.
Re^3: map split vs array split
by GrandFather (Saint) on Jul 31, 2007 at 00:19 UTC

    Note that chomp can act on an array so you can:

    use strict; use warnings; my $file1 = <<FILE; apple goat chocolate newyork FILE open IN, '<', \$file1; my @lines = <IN>; close IN; chomp @lines; print "@lines1\n";

    Prints:

    apple goat chocolate newyork

    DWIM is Perl's answer to Gödel