# $frozen_cmd contains the command that provides the data I posted originally in the 'G' section $ssh->send("$frozen_cmd"); my %frozen; while ( defined ($line = $ssh->read_line()) ) { $frozen{$line} = ''; } my $key; foreach $key (%frozen) { # $tmpcmd1 contains the command to look for just the specific entry of "B" for that one group $ssh->send($tmpcmd1); my $frozhost = $ssh->read_line(); $frozen{$key} = $frozhost; }