We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You are overwriting %ServerStatus in each iteration of your loop. Instead of your assignment, try:
$ServerStatus{ $Ip[$i] } = [ $Names[$i], "unknown" ]; You can also use map and one assignment instead of foreach: %ServerStatus = map { $Ip[$i] => [ $Names[$i], "unknown"] } 0 .. $#Ip; In reply to Re: Initializing a hash using a foreach loop
by gaal
|
|