c has asked for the wisdom of the Perl Monks concerning the following question:
i'm printing a new line into a file and then i sort it and print it back onto itself. i'm using the following code for the sorting and printing:
## sort the new list of virtusers open(FH, $virttmp); @virtusers = <FH>; close(FH); ## write sorted file contents back onto itself open(FH, ">$virttmp"); print FH (sort @virtusers); close(FH);
this seems neat enough, but is there a quicker way to do this? i dont believe that sort can be used on a filehandle, but is this really the most efficient way to get the desired results?
humbly -c
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sorting a file and printing it back onto itself
by Chady (Priest) on Nov 17, 2001 at 20:00 UTC | |
Re: Sorting a file and printing it back onto itself
by Zaxo (Archbishop) on Nov 17, 2001 at 22:44 UTC | |
Re: Sorting a file and printing it back onto itself
by kwoff (Friar) on Nov 18, 2001 at 04:53 UTC |
Back to
Seekers of Perl Wisdom