"Catriona Wordsworth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi guys, > > Needing a little assistance with some issues I am having trying to get my script to print variable details into and email generated by the script. > > so far the script generates the email with (sendmail-t) etc > > then goes on print MAIL "print this" > > what I now want it to do is this... > > if ($variable eq "this") {then print MAIL " this is it"} > elsif ($variable eq "that") {then print MAIL "that isn't it"} > elsif ($variable eq "then") {then print MAIL "I don't know"} > > but when I do this it asks if I need to define the print and when I take out print MAIL it doesn't work at all. >
I dont understand what the sentence above means and your conditional is not perl code, but you should use a hash instead of the conditional above: my(%messages) = ( this => "this is it", that => "that isn't it", then => "I don't know" ); print MAIL $messages{ $variable }; Use your $variable to conditionally determine which hash value to send. And please use descriptive identifiers. We already know $variable is a variable. HTH, Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]