in reply to Re^3: Strange read file behaviour
in thread Strange read file behaviour

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