in reply to Re^4: Sort log file alphabetically
in thread Sort log file alphabetically
while(<DATAOUT>) {
attempts to read from DATAOUT, which you just opened for writing only. As a result, the test (successful read from DATAOUT) fails and the body of your while is not executed. If you had use warnings;, you would have been told that DATAOUT was open only for output.
You don't need that while loop, the for loop will do the job you want done.
You should always
It's also a GoodIdea touse strict; use warnings;
open(FH, ....) or die "error opening FH: $!";
In Section
Seekers of Perl Wisdom