Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Sorting a file and printing it back onto itself

by Chady (Priest)
on Nov 17, 2001 at 20:00 UTC ( [id://126025]=note: print w/replies, xml ) Need Help??


in reply to Sorting a file and printing it back onto itself

I think you can minimize multi-opening files by opening once:

open FH, "+>>$virttmp" or die "Cannot open file: $!\n"; seek FH, 0, 0; my @v = <FH>; seek FH, 0, 0; truncate $virttmp, 0; print FH sort @v; close FH;

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-26 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found