Why is my Perl program not reading from the input file? -
i'm trying read in file:
oranges apples bananas mangos
using this:
open (fl, "fruits"); @fruits while(<fl>){ chomp($_); push(@fruits,$_); } print @fruits;
but i'm not getting output. missing here? i'm trying store lines in file array, , printing out contents on single line. why isn't chomp removing newlines file, it's supposed to?
i'm guessing have dos-style newlines (i.e., \r\n) in fruits file. chomp command works on unix-style (i.e., \n.)
Comments
Post a Comment