--- Lance Prais <[EMAIL PROTECTED]> wrote:
> I am unseeing the following piece of code to send email.  In order for this
> email to be generated there needs to be an error in my script.
> 
>   use Mail::Sendmail;                    #Send and email if there are errors
>   %mail = ( To      =>  '[EMAIL PROTECTED]',
>             From    =>  '[EMAIL PROTECTED]',
>             Subject =>  'Email Manager not running',
>             Message =>  'Email Manager not running'
>            );
>   sendmail(%mail) or die $Mail::Sendmail::error;
>   print "OK. Log says:\n", $Mail::Sendmail::log;
> 
> 
> I would like to include  in the message excepts from the .txt docoment I am
> reading.  Does any one know how to do this?
> 
> I tried to use '((substr($line, 42, 7)' which the text I want to include but
> it did not show the output.

Lance,

If you want variables to interpolate in a string, you need to use double quotes, not 
single ones.

    my $foo = 'bar';
    print "Foo:  $foo"; # prints Foo:  bar
    print 'Foo:  $foo'; # prints Foo:  $foo (probably not what you wanted)

Thus, you could do this:

    my $message = substr($line, 42, 7);
    %mail = ( To      =>  '[EMAIL PROTECTED]',
              From    =>  '[EMAIL PROTECTED]',
              Subject =>  'Email Manager not running',
              Message =>  $message
            );
    sendmail(%mail) or die $Mail::Sendmail::error;

There are a variety of things that will *not* interpolate in built-in strings.  
Subroutines and
built-in functions are two of those things.  Thus, '((substr($line, 42, 7)', which 
relies on a
built-in function, will not interpolate, even if put into double quotes.

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to