On 9 Nov 2006 at 10:49, Tom Phoenix wrote: > On 11/9/06, Beginner <[EMAIL PROTECTED]> wrote: > > > I have a file that, I think is in a binary format, containing emails. > > The file is from my email client, Pegasus, and I want to extract all > > the emails stored within the file and write them to separate files. > > There are some modules on CPAN for dealing with mail files. Would one > of them do what you want? > > http://search.cpan.org > > The 'file' command may be able to tell you more about the file format. > Good luck!
Unfortunately not. there are modules for unix mailbox format mailboxes but not the humble Pegasus (win32). I am not sure what the file command can tell me here: file -i FOL03463.PMM FOL03463.PMM: application/octet-stream One of the things i am unclear about is that how I search for strings within the file. If it's opened like this: open my $FH, '<:raw',$f or die "Can't open $f:$!\n"; binmode($FH); # Is this necessary? Can I use regex to search for patterns like my ($subject) = ($_ =~ /^Subject:(.*)/); or do i have to do something more exotic as the file is being read as binary? Also as the terminating strings looks like this: "^ZX-cs: R" ( I can't paste it in or my email program formats it as a new line) can I use regex to find the end of a mail or do I have to look for the hex; 1a 58 2d 63 73 3a 20 52. These and other questions go begging. Any (useful) comments appreciated. Dp. ==== Data ======= X-RS-ID: <Default> X-RS-Flags: 0,0,1,1,0,0,0 X-RS-Sigset: -1 Subject: New ftp account created MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 8BIT Date: Fri, 20 Jan 2006 14:48:05 -0000 X-PMFLAGS: 34209920 0 0 7HB7PENI.CNR I ================ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>