I'm not sure the title is exactly what I need, but the concept seemed matrix-related, so... here goes!

I have a two files, one for employee names and one containing employee group names.
For example:

Names File
employee1=John
employee2=Jane
employee3=Bob
employee4=Barbara
employee5=Mike
employee6=Mary

Groups File
it_managers=employee1,employee2
is_managers=employee3, employee4
database_managers=employee4,employee5
network_managers=employee6

I have successfully parsed and stored these definitions in a hash, creatively named %employees, such that the hash looks like:

For the names:

$employees{'employee1'} equals John
$employees{'employee2'} equals Jane ... etc

and for the groups

$employees{'it_managers'}[0] equals John
$employees{'it_managers'}[1] equals Jane ... etc

I have a third file which contains references to these objects, using variable notation in sentences, such as:

$it_managers, you will be meeting with $is_managers at 1:00 and $network_managers at 2:00.
$database_managers, please perform data backups for $employee2 and $employee6.

These sentences are parsed and stored in an array named @reminders, such that the array looks like:

$reminder[0] equals $it_managers, you will be meeting with $is_managers at 1:00 and $network_managers at 2:00.
$reminder[1] equals $database_managers, please perform data backups for $employee2 and $employee6. ... etc

The part I'm finding challenging is how to substitute the values referenced in these sentences.
For the above sentences, I would like to have the following stored in a separate array, perhaps one called @all_reminders.

Sentence 1:

John, you will be meeting with Bob at 1:00 and Mary at 2:00
John, you will be meeting with Barbara at 1:00 and Mary at 2:00
Jane, you will be meeting with Bob at 1:00 and Mary at 2:00
Jane, you will be meeting with Barabara at 1:00 and Mary at 2:00

Sentence 2:

Barbara, please perform data backups for Jane and Mary.
Barbara, please perform data backups for Jane and Mary.
Mike, please perform data backups for Jane and Mary.
Mike, please perform data backups for Jane and Mary.

After the substitutions, @all_reminders would (preferrably) look like:

$all_reminders[0] equals John, you will be meeting with Bob at 1:00 and Mary at 2:00
$all_reminders[1] equals John, you will be meeting with Barbara at 1:00 and Mary at 2:00 ... etc

I've tried to be as thorough as possible with my explanation, please let me know if you need me to elaborate further.

And as always, thanks for any help you can provide. :)


In reply to Creating, Using, and Manipulating Matrices' values by joule

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.