foreach $image (@htmlimages) { $msg->attach( Type => 'image/gif', Id => $image, Path => "./$image" ); }