Greetings
Here is the format of my notify file:
e-internalteam: e-randy;e-joel;e-darren
e-randy: [EMAIL PROTECTED]
e-joel: [EMAIL PROTECTED]
e-darren: [EMAIL PROTECTED]
I'm trying to build a hash of arrays that looks like this:
e-internalteam [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
e-randy [EMAIL PROTECTED]
e-joel [EMAIL PROTECTED]
e-darren [EMAIL PROTECTED]
Here is my code:
#!/usr/bin/perl -w
use strict "refs";
#-----------------------------------------------------------------
# define some variables
#-----------------------------------------------------------------
$notify_file = "/usr/local/bin/unix_notify";
open(NOTIFY, $notify_file) or
die "$0: cannot open $notify_file: $!\n";
# load the notify file into a hash -------------------------------
while ( <NOTIFY> )
{
chomp; # remove newline char
next if /^\s*#/; # skip comments
next unless s/^(.*?):\s*//; # look for xxx: yyyy format
$notify_email{$1} = [ split /;/ ];
}
# insure any notify codes are resolved
foreach $key ( keys(%notify_email) )
{
print "the notify code is $key\n";
foreach my $element ( @{ $notify_email{$key} } )
{
print "the email address is $element\n";
if (exists $notify_email{$element})
{ push my @new_array, (@{ $notify_email{$element} }); <===
problem here
print "new array is @new_array\n";
}
}
}
close NOTIFY;
My problem seems to be that I cannot replace the element in the
first hash entry with its value from later hash entries. I thought
if I could create a new_array and then reassign the first hash
entry...???
Any and all suggestions are welcome.
thanks...randy epperson
Lands' End Unix sysadmin
[EMAIL PROTECTED]
Don't anthropomorphize computers. They hate that.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]