procmail
[Top] [All Lists]

Re: Piping From Line to PERL Script

1997-11-24 10:05:54
On Sun, 23 Nov 1997 14:14:05 -0500 (EST), Liston Bias 
<bias(_at_)pobox(_dot_)com>
wrote:
SUBJECT=`formail -xSubject:`
FROM=`formail -rt -xTo:`
<...> 
Then you can reference the variable in perl script, using the following:
(NOTE: the subject will only grab the first word)
----------------- test.pl ----------------------
$from = $ARGV[0];
$subject = $ARGV[1];

Actually, you don't have to pass these on the command line, because
they will already be in the environment that Perl sees (and so you can
also avoid the troubles of having to quote things you want passed
verbatim, i.e. you will get the entire subject line here):

    $from = $ENV{"FROM"};
    $subject = $ENV{"SUBJECT"};

Hope this helps,

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

<Prev in Thread] Current Thread [Next in Thread>