in reply to Adding element to Array?

chomp is your friend.

If the $list is EMPTY, it will only contain a linefeed character(linux), which will be removed by chomp, so the following code should work:

chomp $list; push @array,$list if length($list) > 0;
More experienced programmers would probably use a regular expression, looking for a "word" character before collecting it.

     Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)