open DIRECTORIES, "<", $source or die $!; while () { s/\s+\z//; # Remove trailing whitespace, incl \r and \n ... }