davidj has asked for the wisdom of the Perl Monks concerning the following question:
Hey everyone,
I have a situation at work in which managements desired solution is an email, .forward, and a perl script. Basically, it needs to process the email content, do some db stuff, and log some stuff.
As this is the first time I've done something like this, there's one thing in particular I do not understand. When I do this:
The file does not get opened and written to.#!/usr/bin/perl while (<STDIN>) { -- process the email content } -- do the db stuff here open(FILE, ">logfile"); ---write to logfile close(FILE);
However, when I do this:
the file does get opened and written to.#!/usr/bin/perl open(FILE, ">logfile"); while (<STDIN>) { -- process the email content } -- do the db stuff here ---write to logfile close(FILE);
My guess is that it has to do with I/O and buffering. The only thing I could think of was to set $|=1;, but that didn't work. I could do it the second way, since its pretty trivial, but I would really like to know how to do it the first way.
As always, thanks for your wisdom
davidj
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: sending an email to a perl script
by grinder (Bishop) on Nov 16, 2006 at 17:37 UTC | |
Re: sending an email to a perl script
by Melly (Chaplain) on Nov 16, 2006 at 17:32 UTC | |
Re: sending an email to a perl script
by blahblahblah (Priest) on Nov 17, 2006 at 12:20 UTC | |
Re: sending an email to a perl script
by GrandFather (Saint) on Nov 16, 2006 at 19:40 UTC | |
by chromatic (Archbishop) on Nov 16, 2006 at 22:59 UTC | |
Re: sending an email to a perl script
by j3 (Friar) on Nov 16, 2006 at 20:30 UTC |
Back to
Seekers of Perl Wisdom