Greets: Your procedural approach was trippy.

I tried to preserve the flavour and wrote a
dumper like explanation. See that offset?
Well thats the trip, on the recipient stack.
None the less,heres the gist:

interoffice memo to learn modular arithmetic to---- >myemail@testmail.com interoffice memo to learn modular arithmetic to---- >email2@testmail.com interoffice memo to learn modular arithmetic to---- >anothe@test.comn interoffice memo to learn modular arithmetic to---- >yaea@sendmail.edu
accomplished with:

#! /usr/bin/perl $_mergeFields="##fname##;##lname##;##email##;##phone##"; $_list_to_send_to= "Richard;Smith;myemail\@testmail.com;8005551212| Toby;Johnson;email2\@testmail.com;8885551212| Chanty;Perkins;another\@test.comn;8665551212| Eli;Codernaught;yaea\@sendmail.edu;8225551212"; %_merData = (); %_mergedData = (); $_field = 0; while($_mergeFields){ $_field++; ($_tempVar,$_mergeFields)= split /\;/, $_mergeFields,2; $_merData{$_field} = $_tempVar; print "FieldsStack=$_field:\n". "pop \t$_tempVar\n". "==Fields stack:$_mergeFields\n"; } $_field = 0; $_recipient_list=0; while($_list_to_send_to) { $_recipient_list++; ($_tempVar,$_list_to_send_to) = split /\|/,$_list_to_send_to, +2; my $_tempMailMessage = $_message; my $_tempSubject = $_subject; print "\nRecipient Stack:\n$_list_to_send_to\n". "pop array:$_tempVar\n"; while($_tempVar) { $_field++; ($_tempVar2,$_tempVar) = split /\;/, $_tempVar +, 2; $_mergedData{$_field} = $_tempVar2; print "FieldStack=$_field:\n". "pop \t $_tempVar2\n". "==Fields stack: $_tempVar\n". "-----------------\n"; }} for $key (keys(%_merData)) { $_tempMailMessage =~ s/$_merData{$key}/$_mergedData{$key}/ig; $_tempSubject =~ s/$_merData{$key}/$_mergedData{$key}/ig; $copykey=$key+1; if($_merData{$key} =~ /email##$/) { $coef=$recipx*$copy +key; $ultrakey=$coef-1; $__to=$_mergedData{$ultrakey}; print "\n\ninteroffice memo to learn modular arithmetic to---- +>$__to\n"; }}} #go_send_the_message($__to,$_tempSubject,$_tempMailMessage);} for $recipx(1...$_recipient_list){
Which you might want to run. Happy Coding

In reply to Re: merging two fields of data into one hash or array by dReKurCe
in thread merging two fields of data into one hash or array by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.