in reply to <STDIN> input

In order for the user to be typing interactively and have multiple lines assigned to a single scalar string, you have to tell the user to use some special string to indicate that the multi-line input is complete and it's time for the program to move on to the next task. If I wanted to do something like this, I would probably handle it as follows:
my %email; my @parts = qw/From To Subject cc bcc body/; for my $part ( @parts ) { my $prompt = ( $part eq 'body' ) ? " (type EOT alone on a line to finish):\n" : ": "; print "Enter value for $part$prompt"; $email{$part} = <STDIN>; if ( $part ne 'body' ) { chomp $email{$part} } else { while ( $email{$part} !~ /EOT\s+$/ ) { $email{$part} .= <STDIN>; } s/EOT\s*$//; } } # add more parts to %email as you see fit (priority, port, etc) # (updated to fix logic so that chomp is applied where needed, # also fixed bad quotation mark and confusion in variable names, # and added deletion of "EOT" from $email{body})
In other words, you have to implement the equivalent of a  << HERE block for user input from STDIN.

Having said that, I have to admit that I really dislike this sort of interactive input to a perl script. It's so easy to make a mistake while typing to a script's STDIN, and so hard to allow for a mistake to be fixed once it has been made. Most of the time, the user has to interrupt the script and just start over, and unless there is a fairly good facility for line editing, copy/paste, etc (see Term::ReadLine and related modules), it may take several tries to get all the inputs right.

It is much beetter to use the features already provided by the shell: pipes or files for multi-line input to a script, command-line args for essential parameters, and with the better shells (korn, bash) a very thorough handling of command line editing and ability to recall, modify and re-execute previous commands.

This way, the user composes their multi-line email body with a text editor of their own choosing and stores this to a plain text file; then they run your script with args on the command line to set the "from", "to", "cc", "bcc" and "subject" fields as needed, and feed the message body via a pipeline (or just have the file name as a last command line arg), to be read inside the script with  while (<>). Problems with the message body will be worked out in a standard text editor; if the user makes any mistakes with the other parameters, those are all on the command line, and the shell makes them easy to fix.