in reply to Append Logic

Looks to me like you're keying the hash on the wrong data -- I think you'd have an easier time if you keyed your hash on $host and stored an array of $router's for each host.

So your hash assignment would like this:

push @{$hash{$host}}, $router;

And your current foreach loop would then be:

foreach $key (keys %hash) { print "$program $key $matrix "; print "$path/CISCO_$_.clean " for @{$hash{$key}}; print "\n"; }

Replies are listed 'Best First'.
Re: Re: Append Logic
by Anonymous Monk on Jan 31, 2001 at 02:56 UTC
    Thanks! The only thing I dont know how to do is actually execute each line of output as an individual command.
      You can use system, or open, or backticks, or qx//. Depending on what you want, perlfaq8 has a question entitled How can I capture STDERR from an external command? that has more information than you need to answer this question.

      The appropriate answer depends on many things. Do you want to capture the output? Do you want just the exit code? Do you want to pass extra commands while the program executes?