#============= your logic goes here ================== # execute commands # collect cs_vlan ip info my $response = $connect->cmd('tmsh list cm device all-properties | grep configsync-ip',{-prompt => '#'}); # set ips from output to variables # use variables in additional commands # analyze the output and create resposes for print my $target; if ($response =~ /(\.....d+\.\d+\.\d+\.\d+….)/) { $target = $1; } #================================================= my $2ndresponse =….. …. $connect->cmd('exit'); $connect->disconnect; # PRINT WHATEVER YOU WANT TO SHOW TO POLICIES print "\n$FINALresponse\n";