Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a subroutine that outputs words in my subject area of my mail hash and works great but I now want to add words to the subject area without touching my subroutine.

I was wondering how I can get some additional words with my subroutine in the Mail "Subject" part. The Subject outputs "first word" with no problem but I want to add additional text to the subject (without touching my subroutine) so my output is "first word another word here".
Any experts can advise how I would do this in my mail hash??
sub mal { my $webname = "first word"; return $webname; } use Mail::Sendmail; my %mail = ( To => 'you@hotmail.com', From => 'me@hotmail.com', Subject => mal(), #this gives me output in my ma +il subject of "first word" Message => "data here", );
I have tried all these below (in my subject part of this hash) and all of my attempts are not working:
Subject => "mal() ,another word here", Subject => 'mal() ,"another word here', Subject => mal() 'another word here',
I can not get this to work after many different tries at it. Please advise how I can get the hash part to accept additional words along with my mal() subroutine so it outputs in my subject part of the email:

"first word another word here"

instead of:
"first word"

Replies are listed 'Best First'.
Re: Subroutine in a hash
by the_slycer (Chaplain) on Sep 19, 2002 at 18:57 UTC
    You're close..
    Subject => mal() . "another word here",
      Thank you!