I've devised a sorting routine that sorts by date, then userID. It does this by copying every entry with a certain date to a file named by that date, sorting all of those files by ID with File::Sort, then putting them all back together again. I'm doing it this way and not some easier way because I'm working with files of a very large size- hence (I suppose) this error: # Too many open files File 'Dev:Pseudo'; Line 38 Once I put an || die command on the line opening the files, I got this message (59 is the number of files open) : # 59, Too many open files, <IN> chunk 107782. File 'seraphX:Desktop Folder:Summarize Workspace:Sorting Machine'; Line 24 Can I only have 59 files open at a time? If it's constrained by memory (which I assume would give me a memory error) I've got 40mb assigned to Perl right now. Can anyone help? This script does work fine on smaller files, with fewer dates. For note, all lines in the files processed start with "userid\tdate\t" and they're standard tab-delimited. #!perl require "GUSI.ph"; require "StandardFile.pl"; use File::Sort qw(sortFile); print STDOUT "The Sorting Machine\n"; print STDOUT "Version 1.0\n\n"; if ($#ARGV < 0) { # No dropped files die "No input, no output" unless $file = &StandardFile'GetFile("File to read?", ( "TEXT" ), "Accounting Log" ); } open (IN, "$ARGV[0]"); while (<IN>) { chomp; split/\t/; $date = "$_[1]"; if ($dates !~ m/$date/) { $dates .= "$date\n"; push (@dates, $date); open ($date, ">$date") || die "$#dates, $!"; print $date "$_\n"; }else{ print $date "$_\n"; } } close IN; @dates = sort datesort @dates; open (OUT, ">sorted.tab"); for $dtc (@dates) { close $dtc; sortFile($dtc, $dtc); open (IN2, "$dtc"); while (<IN2>) { chomp; print OUT "$_\n"; } close IN2; unlink $dtc; } close OUT; rename "sorted.tab", "ARGV[0]"; sub datesort() { @a = split/\//,$a; @b = split/\//,$b; if ($a[2] > $b[2]) {return -1;} elsif ($a[2] < $b[2]) {return 1;} else{ if ($a[0] > $b[0]) {return -1;} elsif ($a[0] < $b[0]) {return 1;} else{ if ($a[1] > $b[1]) {return -1;} elsif ($a[1] < $b[1]) {return 1;} else{return 0;} } } } - Strider - I hope you recognize what you're looking for when you find it. ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch