how could I pass this array of hashes "@imgs" to this module?
Normally, you'd pass a reference to it, i.e. \@imgs
email( {to=>$to, from => $email, ..., imgs => \@imgs} ); ... sub email { my ($vals) = @_; ... my $imgs = $vals->{ imgs } || []; ...
Further on, you then just dereference it the usual way: @$imgs for the entire array, or $imgs->[0] for a single element (which would be a hashref in your particular case).
See also perlreftut and perlref.
P.S. you probably don't want to supply an empty hashref ({}) as defaults for things which are normally just scalars/strings, such as your
my $to = $vals->{ to } || {}; my $from = $vals->{ from } || {}; my $subject = $vals->{ subject } || {}; ...
In reply to Re^3: Attaching images to email html template help!
by Eliya
in thread Attaching images to email html template help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |