#from the .pl file call the module ... mod_email( {to=>$to, from => $email, subject=>$subject, body=>$body, ttparams => $templ_data},imgs=>@imgs ); #now this part would be code inside of the module mod_email ... sub process_email_stuff { my ($vals) = @_; my $to = $vals->{ to } || {}; my $from = $vals->{ from } || {}; my $subject = $vals->{ subject } || {}; my $body = $vals->{ body } || {}; my $ttparams = $vals->{ ttparams } || {}; #questioning this: my @imgs = $vals->{ imgs } || {}; my $msg = MIME::Lite::TT::HTML->new( From => $from, ... #all the other stuff its done, now get to the @imgs processing, hopefully. for my $img (@imgs ) { $msg->attach( %$img ) or die "Error adding $img- {Filename}: $!\n"; } ... 1;