Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^5: Sort log file alphabetically

by broomduster (Priest)
on Jul 28, 2008 at 17:26 UTC ( #700599=note: print w/replies, xml ) Need Help??

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

use strict; use warnings;
It's also a GoodIdea to

open(FH, ....) or die "error opening FH: $!";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://700599]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2020-07-04 00:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found