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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -