In article <[EMAIL PROTECTED]> wrote 
"Nikola
Janceski" <[EMAIL PROTECTED]>:

> I am using a module function (method) that requires an anonymous hash as the first 
>parameter.
> 
> ie. $sender->OpenMultipart({from => $FORM{'from'}, to => $FORM{'to'}, cc => 
>$FORM{'cc'},
>                        subject => $FORM{'subject'} } ) || die
> "$Mail::Sender::Error\n";
> 
> but sometimes $FORM{'cc'} contains nothing and the module complains about it.
> 
> I want to be able to pass the method an anonymous hash.. can someone correct this: 
>note: I have
> already done checking on the contents of $FORM so the values are real (true values) 
>or "" (false);
> 
> 
> my %TEMP;
> foreach $key ( qw( from to cc subject ) ){
>       $TEMP{$key} = $FORM{$key} if $FORM{$key}
>       }
> 
> $sender->OpenMultipart( { %TEMP } ) || die "$Mail::Sender::Error\n";
> 
I don't know what's there to correct. 
It's nice and simple to understand.

All I can say, is that there's a shorter way:
my %temp = map {$_ => $form{$_}} grep {$form{$_}} keys %form;
$sender->OpenMultipart(\%temp) or die "$Mail::Sender::Error\n";

Greetings,
Andrea

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to