joule has asked for the wisdom of the Perl Monks concerning the following question:
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. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating, Using, and Manipulating Matrices' values
by kvale (Monsignor) on Apr 01, 2004 at 21:03 UTC | |
|
Re: Creating, Using, and Manipulating Matrices' values
by artist (Parson) on Apr 01, 2004 at 20:58 UTC |