while () { chomp $_; $a[$i]=$_; $i++; } #### @a = ; # diamond operator in "list" (or array) context # will read all input records into array elements chomp @a; # chomp can work on a list #### while () { chomp; # $_ is the default arg to chomp; # ... do other things to $_ if necessary ... push @a, $_; # add a new element at end of @a } #### perl -e '@a=qw/one two three four/; print @a,$/' perl -e '@a=qw/one two three four/; print "@a$/"' perl -e '@a=qw/one two three four/; print join(" ", map { "foo=$_" } @a), $/'