Re: Reading large mbox files

2004-11-27 Thread Dan Jones
On Sun, 2004-11-28 at 04:09 +0100, Gunnar Hjalmarsson wrote: > Dan Jones wrote: > > > > local $/ = "\n\nFrom "; > > > > $_ = ; > > $_ =~ s/\n\nFrom $//; > > ProcMessage($_); > > > > while() { > > $_ =~ s/\n\nFrom $//; > > ProcMessage("From $_"); > > > > if(Pause() == 0) { > >

Re: Reading large mbox files

2004-11-27 Thread Gunnar Hjalmarsson
Dan Jones wrote: local $/ = "\n\nFrom "; $_ = ; $_ =~ s/\n\nFrom $//; ProcMessage($_); while() { $_ =~ s/\n\nFrom $//; ProcMessage("From $_"); if(Pause() == 0) { last; } } close MAILBOX; sub ProcMessage($){ my $message = shift; print "Message:\n $mess

Re: Reading large mbox files

2004-11-27 Thread Dan Jones
On Sat, 2004-11-27 at 23:07 +0100, Gunnar Hjalmarsson wrote: > Dan Jones wrote: > > The most obvious method is to set $/ to the regex /\n\nFrom / > > (messages in mbox format are seperated by a blank line and begin with > > a From line) and to read in email messages one at a time. > > From "perld

Re: Reading large mbox files

2004-11-27 Thread Gunnar Hjalmarsson
Dan Jones wrote: The most obvious method is to set $/ to the regex /\n\nFrom / (messages in mbox format are seperated by a blank line and begin with a From line) and to read in email messages one at a time. From "perldoc perlvar": "Remember: the value of $/ is a string, not a regex." So that method

Reading large mbox files

2004-11-27 Thread Dan Jones
I'm looking to write a utility to do some processing on email messages stored in mbox format. Some mbox files can be quite large, hundreds of megs or perhaps gigs in size. Obviously, reading in the whole file at once isn't feasible. The most obvious method is to set $/ to the regex /\n\nFrom / (