Ok, I've spent 4 + hours trying to figure this one out, in addition to
digging through the perlfaq and the O'reilly Perl books... I have two
hashes that are made from 4 arrays.... it's easier if I show you the code:
@nbnames = qw (bob1 bob2 james1 janes2 james3);
@logpaths =qw (blogs1 blogs2 jlogs1 jlogs2 jlogs3);
@hostsnames=qw(www.bob.com www.james.com);
@number_of_servers=qw(2 3);
foreach (@nbnames) {
$nbname= $_;
$serverinfo{$nbname} = $logpaths[$counter];
$counter=$counter+1;
}
$counter=0;
foreach (@hostsnames) {
$hostname= $_;
$hostinfo{$hostname} = $number_of_servers[$counter];
$counter=$counter+1;
}
#######################
Ok, that works fine... now here's what I like.. I'd like to do... Since I
know the number of servers for each hostname, I'd like to return the
servernames and logpaths for each one.. I'd like to print them out like:
www.bob.com
bob1
blogs1
bob2
blogs2
bob3
blogs3
www.james.com
j1
jlogs1
j2
jlogs2
j3
jlogs3
The only code I've been close to getting it is:
while ( ($key1, $value1) = each %hostinfo) {
print "$key1 has $value1 servers \n";
print "the servers are\n";
$n=0;
until ($n>=$value1) {
foreach (@nbnames) {
print "$_ $serverinfo{$_}\n";
$n=$n+1;
}
}
}
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]