in reply to Re: Add values to subroutine inside of a loop.
in thread Add values to subroutine inside of a loop.

Yes, it overwrites the last key,value, but this is what I am trying to accomplish:
$success = sent( { to => 'send_to', account => 'to_account', name => 'name', subject => 'subject', title => 'title', link => "/var/www/docs", name => "mydocs", link => "/var/www/read", name => "letters", type => 'docs', });

Replies are listed 'Best First'.
Re^3: Add values to subroutine inside of a loop.
by haukex (Archbishop) on Jul 02, 2018 at 18:41 UTC
    link => "/var/www/docs", name => "mydocs", link => "/var/www/read", name => "letters",

    That is not possible, because hash keys must be unique, so there can only be one key link and one key name in each hash. However, a hash value can be a reference to an array or another hash, which can hold multiple values - for example, the data structure $added shown in the OP could be a hash value. But which data structure is best here depends very much on the sent function, which you haven't shown us. Is this a function you've written yourself, or is it from an existing module? What data format does that function expect?