while () { chomp; my ($date, $file_name) = split(","); $date =~ s@\r|\n@@g; # get rid of trailing newlines, however formatted