in reply to send form results by email
in thread send form results by email

Well, something like this should do the trick:

sub print_details { my $fh = shift; print $fh "We have recieved your order for a $pizza_size pizza with +"; pizza_toppings(); } open my $sendmail, "| /usr/sbin/sendmail -t" or die ("no sendmail??"); [...] print $sendmail "Subject: ...\n\n"; print_details($sendmail); close $sendmail;

Just make sure you call print_details everywhere with a filehandle as argument.
If this doesn't help you, read the docs I pointed you to, it's all there. ( and here too: open, perlfaq filehandle )

regards,
tomte