-------------------- show port-channel database ------------------ port-channel 1 Administrative channel mode is on Operational channel mode is on Last membership update succeeded First operational port is fc1/5 2 ports in total, 2 ports up Ports: fc2/5 [up] fc1/5 [up] * port-channel 3 Administrative channel mode is on Operational channel mode is on Last membership update succeeded First operational port is fc1/1 1 port in total, 1 port up Ports: fc1/1 [up] * ****************************************************************** #### $Rec->{Port_Channel_Name} = "port-channel 1" $Rec->{port_member} = fc2/5 $Rec->{port_member} = fc1/5 . . . $Rec->{port_member} = fcX/X $Rec->{Port_Channel_Name} = "port-channel 3" $Rec->{port_member} = fc1/1 #### for my $Info (@Switch_Array) { if ($Info =~/show port-channel database/) { next unless ($Info ne ""); my @Filter = (split /(port-channel \d\n)/,$Info); print "$1 : $Filter[0]\n"; # for my $Filtered (@Filter) # { # print "$Filtered \n"; } }